This is the code of class Profile and class class Test which I did but it seems wrong with class Test......Why is it wrong?
import static java.lang.Math.*;
public class Profile {
private String name;
private String job;
private int day;
private int month;
public Profile(String name, String job, int day, int month) {
this.name = name;
return day;
}
public void setMonth(int Month) {
month = Month;
}
public int getMonth() {
return month;
}
public void displayWelcome() {
System.out
.printf(
"\nHello %s\nYou are a %sAnd were born on %s/%s\nYou are our member from now. Nice to see you.\n",
getName(), getJob(), getDay(), getMonth());
System.out.println();
}
public void displaySeason() {
if (getMonth() == 3 | getMonth() == 4 | getMonth() == 5)
System.out.println("\nYour birth season is Spring.");
else if (getMonth() == 6 | getMonth() == 7
| getMonth() == 8)
System.out.println("\nYour birth season is Summer.");
else if (getMonth() == 9 | getMonth() == 10
| getMonth() == 11)
System.out.println("\nYour birth season is Autumn.");
else
System.out.println("\nYour birth season is Winter.");
System.out.println();
}
public void displayLuckGuess() {
int I = (int) round(getDay() * getMonth() * random() % 4);
switch (I) {
case 0:
System.out.println("\nBAD");
break;
case 1:
System.out.println("\nGOOD");
break;
case 2:
System.out.println("\nBETTER");
break;
case 3:
System.out.println("\nBEST");
break;
}
}
}
import java.util.Scanner;
public class Test {
public static void main(String args[]) {
Scanner input = new Scanner(System.in);
final int NUMBER = 2;
Profile profiles[] = new Profile[NUMBER];
for (int counter = 0; counter < NUMBER; counter++) {
System.out.println("What's your name:");
profiles[counter].setName(input.nextLine());
System.out.println("What's your job:");
profiles[counter].setJob(input.nextLine());
System.out.println("What's your hobby:");
profiles[counter].setHobby(input.nextLine());
System.out.println("What's your major:");
profiles[counter].setMajor(input.nextLine());
System.out.println("What's your nation:");
profiles[counter].setNation(input.nextLine());
System.out.println("What's your birthday:");
profiles[counter].setDay(input.nextInt());
System.out.println("What's your birthmonth:");
profiles[counter].setMonth(input.nextInt());
System.out
.println("Please select one of the following options, enter 1 or 2 or 3:\n1.Welcome\n2.Your season\n3.Are you lucky today?");
int Option = input.nextInt();
switch (Option) {
case 1:
profiles[counter].displayWelcome();
break;
case 2:
profiles[counter].displaySeason();
break;
case 3:
profiles[counter].displayLuckGuess();
break;
}// end switch
}// end for
}// end main
}// end class