Testing a leap year library

Assignment Help JAVA Programming
Reference no: EM13879014

1. Write a program Checkerboard.java that takes an integer command-line argument N, and uses two nested for loops to print an N-by-N "checkerboard" pattern like the one below: a total of N2 asterisks, where each row has 2N characters (alternating between asterisks and spaces).

The following are sample executions of the program, with the expected output.> java Checkerboard 4
* * * *
* * * *
* * * *
* * * *

> java Checkerboard 5
* * * * *
* * * * *
* * * * *
* * * * *
* * * * *

2. Testing a Leap Year library.

This exercise is about code testing. You are given a ready-made library that has some ‘deliberate bugs'. Your task is to prove that by collecting the evidence (i.e. finding for which input the code produces an incorrect output.)

The code to be tested is provided in class form (i.e. you do not have access to the source code). Thus you are asked to implement black-box testing.

This is how you use the LeapYear code from command line:

> java LeapYear
Usage: 'java LeapYear <year>' (where 'year' is a valid integer in [- 1000 to 9999])

> java LeapYear 2015 false

Now, your task is to write a separate class, name it TestLeapYear and store it in a file named TestLeapYear.java, that will extensively test the LeapYear program and produce the evidence showing that it does not work for all possible input.

You are advised to start by extending the code below (make sure you use the same folder as LeapYear.class):

public class TestLeapYear
{
public static void main(String[] args)
{
boolean isLeap = LeapYear.isLeapYear(2015);
if(isLeap) // we know year 2015 is not a leap year, so we expect a false
{
System.out.println("2015 -> True: Something is wrong!");
}
else
{
System.out.println("2015 -> False: Seems to work ok!");
}
}
}

Submission guidelines/checklist

- You should submit your assignment in electronic form via Blackboard.

- You should name every program as suggested, e.g. Quadratic.java

- The header of your program should include comments with the author name (yourself) & email, a quick description of the program, and any other details that you would like me to know (e.g. whether it compiles, how far you got in your assignment, etc.).

- You should also include comments in the code where appropriate (there is no need for excessive use of comments, but add them where they add clarity).

- Use the coding conventions and readability suggestions discussed in the lectures.

- In your communications, use your UCLAN email exclusively (other email addresses like hotmail, live, gmail, etc.) will be ignored.

- When uploading your submission, make sure you do not forget to attach your programs.

- The submitted programs should be the result of your own personal work. You can look-up the lecture slides, the textbook and even the Web for examples. But you need to be ready to defend your solutions verbally, and even reproduce them on your own in exam conditions.

- Exercises that do not compile are marked up to 40% max. Exercises that do not always produce the desired output or include unnecessary complexity are marked up to 60% max. Exercises that do not use correct styling, coding conventions, appropriate variable naming and comments, are marked up to 80% max. Failing to follow these guidelines will also affect your mark.

Reference no: EM13879014

Questions Cloud

Problem regarding the normal shock stands : Air flows through a duct as in Fig P9.84, where A1 = 24 cm2, A2 = 18 cm2, and A3 = 32 cm2. A normal shock stands at section 2.
The air force ignored marketing costs : Alameda Instruments (AI) has offered to supply the Air Force with computer monitors at cost plus 20 percent.
Calculate optimal price, and profit for organization : Assuming that the firm acts as a monopolist, calculate the optimal price, quantity, and profit (i.e., TR - TC) for the organization. After using algebra to find the solution, present your results graphically.
What are the benefits and costs of fdi to the host country? : What are the benefits and costs of FDI to the host country?
Testing a leap year library : Write a program Checkerboard.java that takes an integer command-line argument N, and uses two nested for loops to print an N-by-N "checkerboard" pattern
Determine the moment of that force : A mechanic uses a piece of pipe AB as a lever when tightening an alternator belt. When he pushes down at A, a force of 580 N is exerted on the alternator B. Determine the moment of that force about bolt C if its line of action passes through O.
Write paper about hatshepsut : Write a a 3-4 pages paper about "Hatshepsut" c. 1473 - 1458 B.C. (18th Dynasty)
Determine the marginal cost of milk production : How have total revenues changed if the actual total production of milk remains unchanged?
Critically analyse the possible effects of e-commerce : Examine the extent to which the role and nature of management accountants might differ within the public and private sectors. Critically analyse the possible effects of e-commerce on the role of the manage- ment accountant.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd