Computers and Technology

35 POINTS In Java PLS
This program is the beginning of an automated order machine. You are programming the piece that gets the number of the order from the label sent to you by the ordering machine.

The ordering machine is simulated with user input. It sends a full label, such as “3. Veggie Burger”.

Fill in the missing code
Your task is to get the number out of the string. To do this, you need to isolate the number by using substring. Then use Integer. valueOf, a static method of Integer that takes a String and returns the integer value contained in the String.

The final program should look something like this

1. Hamburger
2. Cheeseburger
3. Veggie Burger
4. Nachos
5. Hot Dog

Enter label:
5. Hot Dog
Customer ordered number 5

This is the code given:
import java. util. Scanner;

public class PickupWindow
{
public static void main(String[] args)
{
// Create scanner object
Scanner input = new Scanner(System. in);

// Display menu
String menu = "1. Hamburger\n2. Cheeseburger\n3. Veggie Burger\n4. Nachos\n5. Hot Dog\n";

System. out. println(menu);

// Get customer order
System. out. println("Enter label: ");
String customerOrder = input. nextLine();

// Use substring to get the first character (the number)
String combo =

// Create an Integer object by using the static
// method Integer. valueOf(someString)
// to turn the string into an Integer

Integer comboNumber =

// Print out what the customer ordered
System. out. println("Customer ordered number "

}
}

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 10:30, badpotterchris
How would you categorize the software that runs on mobile devices? break down these apps into at least three basic categories and give an example of each.
Answers: 1
image
Computers and Technology, 24.06.2019 00:40, dheydar3506
What is the error in the following pseudocode? module main() call raisetopower(2, 1.5) end module module raisetopower(real value, integer power) declare real result set result = value^power display result end module
Answers: 1
image
Computers and Technology, 24.06.2019 13:00, CarlosParker99
Think of a spreadsheet as a giant calculator spread of paper chart data collector
Answers: 2
image
Computers and Technology, 24.06.2019 16:00, altstattlana
Read these lines from beowulf. often scyld scefing seized mead-benches from enemytroops, from many a clan, he terrified warriors, even thoughfirst he was found a waif, best explains why the author includes this information in theexposition? a. to emphasize that a hero must learn to be fierceb. to remember the famous story of a popular heroc. to express sadness about losing the old heroesd. to see whether people still respect the old heroes
Answers: 1
Do you know the correct answer?
35 POINTS In Java PLS
This program is the beginning of an automated order machine. You are pr...

Questions in other subjects:

Konu
Arts, 15.02.2021 01:00
Konu
Mathematics, 15.02.2021 01:00
Konu
Mathematics, 15.02.2021 01:00