Question
This Java program reads an integer from a keyboard and prints it out with other comments. Modify the comments at the top of the program
This Java program reads an integer from a keyboard and prints it out with other comments. Modify the comments at the top of the program to reflect your personal information.
Submit Assignment1.java for Assignment #1 using Gradescope->Assignemnt1 on canvas.asu.edu site.
You will see that the program has a problem with our submission. Your program is tested with 4 testcases (4 sets of input and output files). In order to pass all test cases, your program needs to produce the same output as the ones given below. (Even one character difference causes failure.) This is a part of Software Engineering Testing process (that we will be discussing in class).
Input 1: 0
Output 1:
This program reads an integer from a keyboard,
and prints it out on the display screen.
Make sure that you get the exact same output as the expected one.
The read number is 0.
Input 2: -1
Output 2:
This program reads an integer from a keyboard,
and prints it out on the display screen.
Make sure that you get the exact same output as the expected one.
The read number is -1.
Input 3: 1
Output 3:
This program reads an integer from a keyboard,
and prints it out on the display screen.
Make sure that you get the exact same output as the expected one.
The read number is 1.
Input 4: -5
This program reads an integer from a keyboard,
and prints it out on the display screen.
Make sure that you get the exact same output as the expected one.
The read number is -5.
The program should follow this:
// Assignment #: 1
// Arizona State University - CSE205
// Name: Your name
// StudentID: Your Student ID
// Lecture: Your Lecture time
// Description: This class reads an integer from a keyboard and prints it out
// along with other messages.
import java.util.Scanner; // use the Scanner class located in the "java.util"
directory
public class Assignment1
{
public static void main (String[] args)
{
int number;
Scanner console = new Scanner(System.in);
number = console.nextInt(); // read an integer entered by a user
// display the number with other messages
System.out.print("This program reads an integer from a keyboard, "
+ " and prints it out on the display screen. "
+ "make sure that you get the exact same output as the expected
one. "
+ "The read number is: " + number + ". ");
}
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started