public static void main(String[] args) {
int option=0;
while(option<8){
Scanner input=new Scanner(System.in);
System.out.println("Welcome! Please enter your name");
String name=input.next();
Person user= new Person(name);
System.out.println("Your id: "+user.getID());
System.out.println("Login successful");
System.out.println("------------------------------");
while(option!=7){
System.out.println("1.Create and host a new meeting");
System.out.println("2.Cancel a meeting");
System.out.println("3.Attend an existing meeting");
System.out.println("4.Leave a meeting");
System.out.println("5.Display my meetings");
System.out.println("6.Display meetings organized by me");
System.out.println("7.Logout");
System.out.println("8.Exit the app");
option=input.nextInt();
switch(option){
case 1:
break;
case 2:
break;
case 3:
break;
case 4:
break;
case 5:
break;
case 6:
break;
case 7:
break;
default:
System.out.println("Please enter a proper option number!");
}
MY AIM IS: WHEN LOGGED OUT IT MUST CREATE A NEW PERSON OBJECT THEN IT MUST ENTER THE MAIN MENU. BUT IT WORKS ONLY FOR ONE PERSON. THE OUTPUT IS THAT WHEN YOU LOG OUT IT WANTS YOU TO CREATE A NEW OBJECT FOREVER, IT DOESNT ENTER THE SECOND LOOP. HOW TO MAKE THESE LOOPS WORK?(IN JAVA LANG)
public static void main(String[] args) { int option=0; while(option<8){ int flag=0; Scanner input=new Scanner(System.in); System.out.println("Welcome! Please enter your name"); String name=input.next(); Person user= new Person(name); System.out.println("Your id: "+user.getID()); System.out.println("Login successful"); System.out.println("------------------------------"); if(option==7) { flag=1; } while(option < 7 || flag>0 ){ System.out.println("1.Create and host a new meeting"); System.out.println("2.Cancel a meeting"); System.out.println("3.Attend an existing meeting"); System.out.println("4.Leave a meeting"); System.out.println("5.Display my meetings"); System.out.println("6.Display meetings organized by me"); System.out.println("7.Logout"); System.out.println("8.Exit the app"); option=input.nextInt(); switch(option){ case 1: break; case 2: break; case 3: break; case 4: break; case 5: break; case 6: break; case 7: break; default: System.out.println("Please enter a proper option number!"); } } } }
public static void main(String[] args) { int option=0; while(option<8){ Scanner input=new Scanner(System.in); System.out.println("Welcome! Please enter...
This is my main code (its about 90% done) : public static void main(String[] args) { int instrumentFam = 0; Scanner input = new Scanner(System.in); System.out.println("Select one of the following instrument families: "); System.out.println("1.Brass\n 2.String\n 3.Woodwind\n 4.Percussion\n " + "5.Display all instruments\n 6.Exit"); System.out.println("->: "); instrumentFam = input.nextInt(); switch (instrumentFam) { case 1: int amount; String choice; System.out.println("How many brass instruments would you like to enter? ");...
what is output public static void main(String args) Scanner keyboard new Scanner(System.in); int u 14; int w 0; int x; int y 5; float z = 6.1 System.out.print("Enter y: "); x keyboard.nextint); System.out.println('y'); System.out.println(x); System.out.println(w*3); x- x+(int)z; System.out.println(x); 0 System.out.println(u); System.out.,println(u); System.out.println"x In" + y); System.out.print(y + z); ) liclosing main method 1 liclosing class header
public static void main(String[] args) { System.out.println("Welcome to the Future Value Calculator\n"); Scanner sc = new Scanner(System.in); String choice = "y"; while (choice.equalsIgnoreCase("y")) { // get the input from the user System.out.println("DATA ENTRY"); double monthlyInvestment = getDoubleWithinRange(sc, "Enter monthly investment: ", 0, 1000); double interestRate = getDoubleWithinRange(sc, "Enter yearly interest rate: ", 0, 30); int years = getIntWithinRange(sc, "Enter number of years: ", 0, 100); System.out.println(); ...
I need the following java code commented import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner input = new Scanner (System.in); int productNo=0; double product1; double product2; double product3; double product4; double product5; int quantity; double totalsales=0; while(productNo !=0) System.out.println("Enter Product Number 1-5"); productNo=input.nextInt(); System.out.println("Enter Quantity Sold"); quantity=input.nextInt(); switch (productNo) { case 1: product1=1.00; totalsales+=(1.00*quantity); break; case 2: product2=2.00; totalsales+=(2.00*quantity); break; case 3: product3=6.00; totalsales+=(6.00*quantity); break; case 4: product4=23.00; totalsales+=(23.00*quantity); break; case 5: product5=17.00; totalsales+=(17.00*quantity); break;...
Given the following Java code: public static void main (String[] args) { int num; System.out.println("Enter a number"); num = scan.nextInt(); <-first input statement while (num != 0) { System.out.println ("The number is: " + num); System.out.println("Enter a number"); num = scan.nextInt(); } //End While } //End Module The first input statement shown above is called the:
JAVA LANGUAGE int choice; Scanner in = new Scanner(System.in); while(true) { System.out.println(); System.out.println("(1) Add a new flight."); System.out.println("(2) Buy ticket."); System.out.println("(3) Request a Check-In."); In this assignment, you are required to improve your flight registration system. Your new system should be able to process check-in of passengers and calculate take-off load of planes. You should also use enums to represent menu items such as; (1)Add a new flight. (2)Buy ticket. (3)Request a Check-In. (4) Process a Check-In. (5) Display Valid...
import java.util.Scanner; public class creditScore { public static void main(String[]args) { // declare and initialize variables int creditScore; double loanAmount,interestRate,interestAmount; final double I_a = 5.56,I_b = 6.38,I_c = 7.12,I_d = 9.34,I_e = 12.45,I_f = 0; String instructions = "This program calculates annual interest\n"+"based on a credit score.\n\n"; String output; Scanner input = new Scanner(System.in);// for receiving input from keyboard // get input from user System.out.println(instructions ); System.out.println("Enter the loan amount: $"); loanAmount = input.nextDouble(); System.out.println("Enter the credit score: "); creditScore...
import java.util.Scanner; public class SCAN { public static void main(String[ ] args) { int x, y, z; double average; Scanner scan = new Scanner(System.in); System.out.println("Enter an integer value"); x = scan.nextInt( ); System.out.println("Enter another integer value"); y = scan.nextInt( ); System.out.println("Enter a third integer value"); z = scan.nextInt( ); average = (x + y + z) / 3; System.out.println("The result of my calculation is " + average); } } What is output if x = 0, y = 1 and...
package bigIntegerPackage; import java.util.Scanner; public class BigIntMathTesterOne { private static Scanner keyboard = new Scanner(System.in); /* * * @param args */ public static void main(String[] args) { /** * Sample valid input and resulting output * "44444444445555555555666666666677777777770000000000" * stores ["4","4","4","4","4","4","4","4","4","4","5","5","5","5","5","5","5","5","5","5","6","6","6","6","6","6","6'<'6","6","6","7","7","7","7","7","7","7","7","7","7","0","0","0","0","0","0","0","0","0","0"] in ArrayList and sets the value to positive *returns string "44444444445555555555666666666677777777770000000000" * "100000" stores ["1","0","0","0","0","0"] in ArrayList and sets the value to positive *returns string "100000" *"+0" stores ["0"] in ArrayList and sets...
import java.util.Scanner; public class TempConvert { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); //ask the user for a temperature System.out.println("Enter a temperature:"); double temp = scnr.nextDouble(); //ask the user for the scale of the temperature System.out.println("Is that Fahrenheit (F) or Celsius (C)?"); char choice = scnr.next().charAt(0); if(choice == 'F') { //convert to Celsius if given temperature was Fahrenheit System.out.println(temp + " degrees Fahrenheit is " + ((5.0/9) * (temp-32)) + " degrees Celsius"); } else {...