Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Question 1: From Chapter 4: Loops Design a program for the Hollywood Movie Ratin

ID: 3634645 • Letter: Q

Question

Question 1:
From Chapter 4: Loops

Design a program for the Hollywood Movie Rating Guide, in which users continuously enter a value from 0 to 4 that indicates the number of stars they are awarding to the Guide’s featured movie of the week. The program executes continuously until a user enters a negative number to quit. If a user enters a star value that does not fall in the correct range, reprompt the user continuously until a correct value is entered. At the end of the program, display the average star rating for the movie. (15 points)

Question 2
From Chapter 6: Methods
Create the logic for a program that calculates and displays the amount of money you would have if you invested $1000 at 5 percent interest for one year. Create a separate method to do the calculation and return the result to be displayed. (15 points)

(hint need to write a method and then call it with values from the main())

Explanation / Answer

1) import java.util.Scanner;

public class rateMovie{
public static void main(String[] args){

Scanner inScan = new Scanner(System.in);
double sum = 0;
double curr = 0;
double ave;
int count = 0;

while (curr >= 0){
System.out.println("Enter a rating (0-4). Negative number to quit.");
curr = inScan.nextDouble();

if (curr > 4){
System.out.println("Invalid value. Not recorded.");
}
if (curr >= 0 && curr <= 4){
sum = sum + curr;
count++;
}

if (curr < 0){
ave = sum/(double)(count);
System.out.println("The average rating is " + ave);
}
}
}
}

2)

Pseudocode:

Enter no of years.

Interest rate= 0.05

amount = 1000

get inteest = call interest method.

now get total amount = amount + interest.

print total amount

end

interset method.

interest = amount * interst rate * no of years / 100;

retrun interest.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote