Need help with my Java question – I’m studying for my class.
1.) Write a simple java program that uses loops. You may use
‘FOR’ or ‘DO-WHILE’ – you decide
. The program should use a loop to
compute the semester average for up to 5 students. In the loop the
user will ask for a student name and their 3 test scores and add them
up and divide the total by 3 giving the semester average.
You will print out the student name and semester average for each
student you process
2.) Write a java program that makes use of the ‘
DO WHILE ’ loop
The program asks a user to enter information about several of their
friends. The information is their last name, the state they live in, their age,
and their expected graduation year.
After you enter one friend, write out each individually.
You must use
JOptionPane to input the 4 fields,
and to output the 4 fields.
Refer to the textbook Code Listing 4-6 to see how to use ‘char repeat’
to terminate the do while loop.
a java program that makes use of
the ‘FOR’ loop.
Assume that a user has a 5 room apartment and is going to put down new
floor covering in all 5 rooms. The program must ask the user to enter the
length of each room in feet and to enter the width of each room in feet [
may use either Scanner or JOptionPane].
Assume that the flooring they plan to use is $10.00 a square yard,
compute how much it is going to cost to cover each room.
At the end print out how much it will cost to cover all 5 rooms in the
Print out on separate lines:
The number of square feet per room,
The number of square yards per room,
The cost to cover each room.
The number of square feet in the apartment,
The number of square yards in the apartment,
The cost to cover the 5 room apartment.
4.) Assume that you own a small office-building complex containing several different buildings. Write a java program that uses the ‘WHILE’ loop which does the following. It should ask the user to enter the total number of buildings in the complex. Then, set up a loop so that you can process each building one at a time within the loop. The loop should ask the user for the number of offices in a given building, and the number of them that are rented. The program must be certain to keep track of the number of offices in a building and the number that are rented, because after the loop quits, the program must print out: the total number of offices that the entire complex has the total number of offices that are rented the total number of offices that are empty the percentage of offices rented.