Skip to content

Yaseerahk/Java_intro

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Working with conditionals, methods

Fork The Repo

  1. Please fork the repo for now
  2. we will start using branching on the second iteration!

Exercises

EvenOdd

  1. In a file called EvenOdd.java, create an application that prompts the user to enter an integer.
  2. Pass the integer to a method that determines weather the integer is even or odd and returns a boolean value.
  3. In the main method, display whether the number is even or odd.

ShadyRestRoom

  1. In a file called ShadyRestRoom.java create an application that determines the price for a room.
  2. Ask the user to choose 1 for a queen bed, 2 for a king bed or 3 for a king bed and pullout couch.
  3. The output must reflect the input and the price of the room: R500 for a queen bed, R700 for king bed and R900 for a king bed and a pullout couch.
  4. If the user inputs an invalid choice display a corresponding message and set the price to R0.
  5. Now ask the user to specify 1 for a lake view or 2 for a park view, but only ask them if the bed size entry is valid.
  6. Add R100 to the price of any room with a lake view.
  7. If the input value for view is invalid display a corresponding message and set the price of the room as lake view.

CellPhoneService

  1. In a file called CellPhoneService.java, create an application that prompts the user for the max monthly amount they need for talking minutes, text messages and gigabytes of data.
  2. Display a recommendation of the best plan for the users needs.
  3. A user who needs less than 500 minutes, and no text messages or data should buy (Plan A at R150 per month).
  4. A user who needs less than 500 minutes and any text messages should buy (Plan B at R210 per month).
  5. A user who needs 500 or more minutes and no data should buy either (Plan C for up to 100 text messages at R90 per month) or (Plan D for 100 text messages or more at R115 per month).
  6. A use who needs any data should buy (Plan E for up to 3 gigabytes at R 150 per month) or (Plan F for 3 gigabytes or more at R230 per month).

NumbersDemo

  1. In a class called NumbersDemo.java, whose main method holds two integer variables.
  2. Prompt the user for the values of those variables.
  3. Pass each variable to the methods, displayTwiceTheNumber(), displayNumberPlusFive(), and displayNumberSquared().
  4. Create each method to perform the task its name implies.

Percentages

  1. In a class called Percentages.java, whose main method holds two double variables.
  2. Prompt the user for the values of those variables.
  3. Pass both variable to a method named computePercentages() that displays the two values and the value of the first number as a percentage of the second one.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%