Question
jHi I've been kind of stumped on this homework assignment. I'm currently on B and cant figure out how to use continue; in my program.
jHi I've been kind of stumped on this homework assignment. I'm currently on B and cant figure out how to use "continue;" in my program.
This is what I have so far:
import java.util.Scanner;
public class pass5A {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.println("What class are you rating?:");
String classRate = scan.nextLine();
System.out.println("How many plus signs does ICS111 get?:");
int plusSign = scan.nextInt();
System.out.print("ICS111:");
{
if (plusSign >= 6)
System.out.println("Sorry, but you can only give a rating of 0-5");
int i = 0;
{
if ((i = 5))
while (i
if (plusSign >= 6) {
continue;
}
System.out.print("+");
i++;
}
}
}
}
}
A. Write a program that reinterprets a course rating as follows: Computer prints and waits for input: What class are you rating? How many plus signs does ICS-111 get? Example user input: ICS-111 Computer prints: ICS-111: + + + + + Your program should print as many plus signs as the user inputs. For example: If the input is 0, the program prints no plus signs If the input is 1, the program prints + If the input is 2, the program prints + + If the input is 3, the program prints + + + ...and so on. Use a loop to generate the plus signs so that your program should work with any positive number. What happens if a user puts in a negative number (try it)? B. Modify the program you wrote in part A so that accepts only 0-5. If a user puts in a number out of range, your program should say Sorry, but you can only give a rating of 0-5 and then loop back to ask again. C. Modify the program you wrote in part B so that it asks about 3 courses. For example: ICS-111 What class are you rating? How many plus signs does ICS-111 get? ICS-211 What class are you rating? How many plus signs does ICS-111 get? ICS-311 What class are you rating? How many plus signs does ICS-111 get? ICS-111: + + ICS-211: + + + + ICS-311: + + + + + D. (Extra credit, 10 points). Modify your program from part C so that it will keep asking about courses until the user inputs Done for the name of the course. The output of the program should then be as many courses as the user has ratedStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started