This is code I am working with for a class and I am unable to get the desired Output required. I am attaching screenshots of the output that needs to take place. please comment on what you are doing so I can learn, I am still a novice at java. Also the program needs to be able to run exactly as the instructor says.
package asi7123;
import java.util.*;
public class Asi7123 {
public static void main(String[] args) {
Scanner keyboard = new Scanner(System.in);
String name;
int age;
String answer;
Person person;
do {
System.out.print("Enter name: ");
name = keyboard.nextLine();
while ("".equals(name)) {
System.out.println("ERROR: Please enter a name");
System.out.print("Enter Name: ");
name = keyboard.nextLine();
System.out.print("Enter age: ");
age = keyboard.nextLine();
// integer lineEntered;
// lineEntered = keyboard.nextLine();
// age = Integer.parseInt(lineEntered);
//
while (age System.out.println("ERROR: age must be 0 or higher");
System.out.print("Enter age: ");
//lineEntered = keyboard.nextLine();
//age = Integer.parseInt(lineEntered);
person = new Person();
person.name = name;
person.age = age;
System.out.println(person.
System.out.print("Another (Y/N): ");
answer = keyboard.nextLine();
if (!"Y".equals(answer)) {
System.out.print("ERROR: Enter Y or N: ");
answer = keyboard.nextLine();
if (!"N".equals(answer)) {
System.out.print("ERROR: Enter Y or N: ");
answer = keyboard.nextLine();
while (answer.equals("Y"));
System.out.println("You entered " + person.size() + " names:");
for (Person elt : people) {
System.out.println(elt.output(
Download Attachments:
JAVA PROGRAM CAP1.PNG
JAVA PROGRAM CAP2.PNG
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
23 | 24 | 25 | 26 | 27 | 28 | 1 |
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 | 1 | 2 | 3 | 4 | 5 |
Get Free Quote!
328 Experts Online