Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Java Expert


Home >> Java

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 ' (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.

Java, Programming

  • Category:- Java
  • Reference No.:- M91547529
  • Price:- $30

Priced at Now at $30, Verified Solution

Have any Question?


Related Questions in Java

Answer the following question whats the difference public

Answer the following Question : What's the difference public inheritance and private inheritance? What can derived classes inherit from base classes? What cannot be inherited from base classes?

Assessment database and multithread programmingtasktask 1

Assessment: Database and Multithread Programming Task Task 1: Grade Processing University grading system maintains a database called "GradeProcessing" that contains number of tables to store, retrieve and manipulate stud ...

Overviewyou are required to use java se 80 and javafx to

Overview You are required to use Java SE 8.0 and JavaFX to develop a Graphical User Interface (GUI) for the FlexiRent rental property management program created in Assignment 1. This assignment is designed to help you: 1 ...

Project requirementsfor the problem described in the next

Project requirements For the problem described in the next section, you must do the following: 1. include your student ID at the end of all filenames for all java code files. Three classes have been identified in section ...

Project descriptionwrite a java program to traverse a

Project Description: Write a java program to traverse a directory structure (DirWalker.java) of csv files that contain csv files with customer info. A simple sample in provided in with the sample code but you MUST will r ...

Assignment - java program using array of objectsobjectives

Assignment - JAVA Program using array of objects Objectives - This assessment item relates to the course learning outcomes as stated in the Unit Profile. Details - For this assignment, you are required to develop a Menu ...

Can someone help me please with those question1what is the

Can someone help me please with those question 1:what is the best data type for student id datatime,currency,number,decimal 2:which relationshipis preferable? one to one,one to many,many to many 3:if you add table A's pr ...

Assignment taskwrite a java console application that allows

Assignment task Write a java console application that allows the user to read, validate, store, display, sort and search data such as flight departure city (String), flight number (integer), flight distance (integer), fl ...

Overviewyou are required to use java se 80 and javafx to

Overview You are required to use Java SE 8.0 and JavaFX to develop a Graphical User Interface (GUI) for the FlexiRent rental property management program created in Assignment 1. This assignment is designed to help you: 1 ...

Assignment game prototypeoverviewfor this assessment task

Assignment: Game Prototype Overview For this assessment task you are expected to construct a prototype level/area as a "proof of concept" for the game that you have designed in Assignment 1. The prototype should function ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As