Waiting for answer This question has not been answered yet. You can hire a professional tutor to get the answer.

QUESTION

The rules for the output message are as follows: The complete message must appear on a single line, ending with a newline (but can be generated piece...

import java.util.Scanner;

public class BikeHire {

 public static void main(String[] args) { 

  Scanner sc = new Scanner(System.in);

  String brand; //preferred manufacturer

  int wheels; //number of wheels: 1, 2, 3 or 4

  boolean twoSeats; //does the bike have two seats?

  //Get preferences from user

  System.out.print("What brand of bike do you want (e.g., Merida, Giant)? ");

  brand = sc.nextLine(); //e.g., in case they say 'Malvern Star'

  System.out.print("How many wheels (1-4)? ");

  wheels = sc.nextInt();

  System.out.print("Should it have two seats (true or false)? ");

  twoSeats = sc.nextBoolean();

  //Display hire details

  System.out.print("Hire details: ");

 System.out.println("Brand:"+ brand + " Wheels:" + wheels + " Seats:" + twoSeats);

 }

}

The rules for the output message are as follows:. The complete message must appear on a single line, ending with a newline (but can be generated piece by piece).. Begin the summary with the bike's brand (the text the user entered earlier)o If the user has requested two seats then output 'tandem'.. If the number of wheels is one, output 'unicycle'. If the number of wheels is two, output 'bicycle'. If three, 'tricycle' and if four, 'quadcycle'. (You can assumethey will only enter values in the range 1-4.)3. Compile and test your program. You can use the following sample input values and expected outputs to test that your program works:brandwheels twoSeaterExpected outputGiantfalseHire details: Giant unicycleMerida2trueHire details: Merida tandem bicycleMalvern Star3falseHire details: Malvern Star tricycleFlying PigeontrueHire details: Flying Pigeon tandem unicycleApollo4falseHire details: Apollo quadcycle
Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question