have some questions about java programming, im stuck on a couple things. I will attatch what I've got so far but here is what I have to do, Create a project named JavaReview. Use a package name of edu.seminolestate.review. You can substitute your domain name for edu.seminolestate if you wish. Create a single class named ReviewApplication. When the application starts, prompt the user to enter 5 floating point numbers. These are numbers that can contain a decimal. You do not need to edit these numbers. Your professor will only enter valid decimal numbers when testing your application. You must store these numbers in an array. Display a menu with five options. These options are add, subtract, multiply, divide, and quit. Below is a sample of the menu. Enter a to add. Enter s to subtract. Enter m to multiply. Enter d to divide. Enter q to quit.   Add all the elements in the array when the add option is selected. Display the final sum using System.out. Subtract each element (elements 2 through 5) in the array from the first element when the subtract option is selected. Display the final result using System.out. Multiply each element in the array when the multiply option is selected. Display the final product using System.out. Divide each (elements 2 through 5) in the array into the first element when the divide option is specified. Display the final product using System.out. End the application when the quit option is selected. Display an error message if the user enters any character other than a, s, m, d, or q. Continue to display the menu and process user selections until the user enters the quit option. Display a closing message before ending the application. Let me know what i am missing. Also how do I display a message and exit when the user enters "Q"? Here is what i've got so far import java.util.Scanner; public class ReviewApplication { public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); double sum = 0; double difference = 0; double product = 0; double divide = 0; boolean looper = true; double[] array = new double[5]; String choice = processMenu(); boolean continueToRun = true; System.out.print(" Enter 5 floating point numbers "); for (int i = 0; i < array.length; i++){ array[i] = keyboard.nextDouble(); sum = sum + array[i]; } System.out.println(sum); processMenu(); switch (choice) { case 1: for (int i = 0; i < array.length; i++){ array[i] = keyboard.nextDouble(); sum = sum + array[i]; } System.out.println(sum); break; case 2: for (int i = 0; i < array.length; i++){ array[i] = keyboard.nextDouble(); difference = difference - array[i];} System.out.println("the difference is" + difference); break; case 3: for (int i = 0; i < array.length; i++){ array[i] = keyboard.nextDouble(); product = product * array[i];} System.out.println("the product is" + product); break; case 4: double total4 = 0; for (int i = 0; i < array.length; i++){ total4 /= array[i];} System.out.println("the answer is" + total4); } break; case 5:System.out.println("enter q to exit"); keyboard.nextLine(); if input ='q'; System.exit; break; while(looper); System.out.println(); System.out.println("Thanks for playing!"); keyboard.close();} } // end of main public static String processMenu( ){ Scanner keyboard = new Scanner(System.in); String response = keyboard.nextLine(); do { System.out.println("Enter a to add numbers"); System.out.println("Enter s to subtract"); System.out.println("Enter m to multiply"); System.out.println("Enter d to divide"); System.out.println("Enter q to exit"); System.out.print(">>> "); response = keyboard.nextLine(); // keyboard.nextLine(); //clear enter key from keyboard buffer if (response != "a" || response != "s" || response != "m" || response != "d"|| response != "q") { System.out.println("Invalid menu slection. Try again."); } }while (response == "a" || response == "s" || response == "m" || response == "d"|| response == "q"); return response; } }

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
100%

I have some questions about java programming, im stuck on a couple things. I will attatch what I've got so far but here is what I have to do,

  1. Create a project named JavaReview. Use a package name of edu.seminolestate.review. You can substitute your domain name for edu.seminolestate if you wish. Create a single class named ReviewApplication.
  2. When the application starts, prompt the user to enter 5 floating point numbers. These are numbers that can contain a decimal. You do not need to edit these numbers. Your professor will only enter valid decimal numbers when testing your application. You must store these numbers in an array.
  3. Display a menu with five options. These options are add, subtract, multiply, divide, and quit. Below is a sample of the menu.
Enter a to add.
Enter s to subtract.
Enter m to multiply.
Enter d to divide.
Enter q to quit.

 

  1. Add all the elements in the array when the add option is selected. Display the final sum using System.out.
  2. Subtract each element (elements 2 through 5) in the array from the first element when the subtract option is selected. Display the final result using System.out.
  3. Multiply each element in the array when the multiply option is selected. Display the final product using System.out.
  4. Divide each (elements 2 through 5) in the array into the first element when the divide option is specified. Display the final product using System.out.
  5. End the application when the quit option is selected.
  6. Display an error message if the user enters any character other than a, s, m, d, or q.
  7. Continue to display the menu and process user selections until the user enters the quit option. Display a closing message before ending the application.

Let me know what i am missing. Also how do I display a message and exit when the user enters "Q"?

Here is what i've got so far

import java.util.Scanner;

public class ReviewApplication {

public static void main(String[] args) {

Scanner keyboard = new Scanner(System.in);
double sum = 0;
double difference = 0;
double product = 0;
double divide = 0;
boolean looper = true;
double[] array = new double[5];
String choice = processMenu();
boolean continueToRun = true;
System.out.print(" Enter 5 floating point numbers ");

for (int i = 0; i < array.length; i++){
array[i] = keyboard.nextDouble();

sum = sum + array[i];
}
System.out.println(sum);
processMenu();
switch (choice) {
case 1:
for (int i = 0; i < array.length; i++){
array[i] = keyboard.nextDouble();

sum = sum + array[i];
}
System.out.println(sum);
break;
case 2:
for (int i = 0; i < array.length; i++){
array[i] = keyboard.nextDouble();
difference = difference - array[i];}
System.out.println("the difference is" + difference);
break;
case 3:
for (int i = 0; i < array.length; i++){
array[i] = keyboard.nextDouble();
product = product * array[i];}
System.out.println("the product is" + product);
break;
case 4:
double total4 = 0;
for (int i = 0; i < array.length; i++){
total4 /= array[i];}
System.out.println("the answer is" + total4);
}

break;
case 5:System.out.println("enter q to exit");
keyboard.nextLine();
if input ='q'; System.exit;

break;
while(looper); System.out.println();
System.out.println("Thanks for playing!");
keyboard.close();}
} // end of main


public static String processMenu( ){
Scanner keyboard = new Scanner(System.in);
String response = keyboard.nextLine();
do {
System.out.println("Enter a to add numbers");
System.out.println("Enter s to subtract");
System.out.println("Enter m to multiply");
System.out.println("Enter d to divide");
System.out.println("Enter q to exit");
System.out.print(">>> ");
response = keyboard.nextLine();
// keyboard.nextLine(); //clear enter key from keyboard buffer
if (response != "a" || response != "s" || response != "m" ||
response != "d"|| response != "q") {
System.out.println("Invalid menu slection. Try again.");
}
}while (response == "a" || response == "s" || response == "m" ||
response == "d"|| response == "q");

return response;

}
}



 

 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY