Mrs. Johnson's Classroom
  • HOME
    • Tutoring/Make-Up
    • Classroom Rules
  • CompuScholar - Instructions

JavaChapter5Review


Write a program that solves the following Information:

#1: TWO WAY SELECTION: the program needs to ask the prompt - "What is the outside temperature?"  If the temperature is warmer than 100 degrees, make the program say "It's way too hot!" Otherwise the program needs to say "Just wait until a summer, it will get hotter!"

#2: BASIC OUTPUT: The program then needs to take the outside temperature and drop the temperature by 20 degree. The screen needs to show "The temperature outside is____. But if you are inside, the temperature is ____."

#3: MULTIWAY SELECTION: the program needs to then ask the user 
"What is your favorite season of the year?
A: Spring
B: Summer
C: Fall
D: Winter"
You will need to create a program that will allow a different response to appear depending on what choice the user entered. Also create a default response in case the wrong button is pressed. 

#4: LOOP: In this same program you will need to create a password/pin to login BEFORE the first prompt appears onto the screen. Make the password to be (4321). Make sure the following message appears if the password is not correct: "Incorrect password. Please try again."  Have a message appear once the correct password is entered stating "Welcome! You are now logged in to the program. Let's begin!" Then the first prompt should begin. 

#5: CREATE METHODS: create 3 new methods. 
cube(x) = x*x*x
double(x)= x*2
half(x)= x/2

Solve the following problems using these 3 methods.
cube(5)
cube(10)
cube(25)
cube(12.5)
cube(10.25)
cube(2)
cube(7.5)
cube(1.50)
cube(22)
cube(30)
double(10)
double(100)
double(50)
double(2.50)
double(17.20)
double(150)
double(22.2)
double(55.55)
double(1000)
double(30)
half(100)
half(22)
half(88)
half(2)
half(542)
half(48)
half(51.24)
half(1)
half(1000)
half(12.25)


#6: REPETITION/LOOP

0   5   10   15   20   25   30   35   40
(Make 1 blank line show up)

3   6   9   12   15   18   21   24   27   30 
(Make 1 blank line show up)

2   4   8   16   32   64   128   256   512 
(Make 1 blank line show up)

30    23    16    9    2
(Make 1 blank line show up)

A   F   K   P   U   Z 
(Make 1 blank line show up) 

X=1
Y=5
VARIABLE CONDITION: Have X repeat and add 2 each time as long as X <=100
WHAT ARE YOU LOOPING?: Change Y++ every time X is looped.
OUTPUT: What is Y?....System.out.println("Y is: " + Y);

Powered by Create your own unique website with customizable templates.