ScholarMatic | 24/7 Homework Help

ScholarMatic Will Help You Write Your Essays and Term Papers

Answered » You can buy a ready-made answer or pick a professional tutor to order an original one.

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…

ScholarMatic: Explanation & Answer

Your ready answer from a verified tutor is just a click away for as little as $14.99


  

Click Order Now to get 100% Original Answer Customized to your instructions!

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

ScholarMatic: Explanation & Answer

Your ready answer from a verified tutor is just a click away for as little as $14.99


  

Click Order Now to get 100% Original Answer Customized to your instructions!

HOME TO CERTIFIED WRITERS

Why Place An Order With Us?

  • Certified Editors
  • 24/7 Customer Support
  • Profesional Research
  • Easy to Use System Interface
  • Student Friendly Pricing

Have a similar question?

PLAGIRAISM FREE PAPERS

All papers we provide are well-researched, properly formatted and cited.

TOP QUALITY

All papers we provide are well-researched, properly formatted and cited.

HIGHLY SECURED

All papers we provide are well-researched, properly formatted and cited.

ScholarMatic: Get Started

Assignment Writing Service

Feel safe and secure when placing an order on our portal!
Fruitful cooperation begins with solid guarantees, and we are professional enough to promise perfect results. Let’s get it started!