0

Hello everyone in this activity i should use if, else if, Boolean, for loop, do while loop
ok here is the OUTPUT i must do:

GRADING SYSTEM!
96-100 =1.00
94-95 =1.25
92-93 =1.50
90-91 =1.75
88-89 =2.00
86-87 =2.25
84-85 =2.50
82-83 =2.75
80-81 =3.00
78-79 =3.25
75-77 =3.50
74-below =5.00

Enter Prelim Grade:100

Enter Midterm Grade:100

Enter Final Grade:100

RATING:1.00
REMARKS:PASSED
CONGRATULATIONS
CONGRATULATIONS
CONGRATULATIONS
CONGRATULATIONS
CONGRATULATIONS
CONGRATULATIONS
CONGRATULATIONS
CONGRATULATIONS
CONGRATULATIONS


//the (congratulations) must be 10 times and if the grade is failed the remarks is FAILED
the (study harder) is 10 times also

Here is my CODE so far:

import java.io.*;
public class PRACTICE {
public static void main(String[]args)throws IOException{
BufferedReader bv = new
BufferedReader(new InputStreamReader(System.in));
String x;
Float pg, mg, fg, ave;

System.out.println("GRADING SYSTEM!");
System.out.println("96-100 =1.00");
System.out.println("94-95 =1.25");
System.out.println("92-93 =1.50");
System.out.println("90-91 =1.75");
System.out.println("88-89 =2.00");
System.out.println("86-87 =2.25");
System.out.println("84-85 =2.50");
System.out.println("82-83 =2.75");
System.out.println("80-81 =3.00");
System.out.println("78-79 =3.25");
System.out.println("75-77 =3.50");
System.out.println("74-below =5.00");

System.out.println("\nEnter Prelim Grade:");
x=bv.readLine();
pg=Float.parseFloat(x);

System.out.println("Enter Midterm Grade:");
x=bv.readLine();
mg=Float.parseFloat(x);

System.out.println("Enter Final Grade:");
x=bv.readLine();
fg=Float.parseFloat(x);

ave=(pg+mg+fg)/3;

if(ave>=96)
System.out.println("RATING: 1.00");
else if(ave>94&&ave>95)
System.out.println("RATING:1.25");
else if(ave>=92&&ave>93)
System.out.println("RATING:1.75");
else if(ave>=90&&ave>91)
System.out.println("RATING:2.00");
else if(ave>=88&&ave>89)
System.out.println("RATING:2.25");
else if(ave>=84&&ave>85)
System.out.println("RATING:2.50");
else if(ave>=82&&ave>83)
System.out.println("RATING:2.75");
else if(ave>=80&&ave>81)
System.out.println("RATING:3.00");
else if(ave>=78&&ave>79)
System.out.println("RATING:3.25");
else if(ave>=75&&ave>77)
System.out.println("RATING:3.50");
else if(ave<=74)
System.out.println("RATING:5.00");

if(ave>=75)
System.out.println("REMARKS:PASSED");
else
System.out.println("REMARKS:FAILED");


}
}

You can EDIT my CODE or make your OWN..
i think i should use for loop or do while loop?
but i don't know what to do next please help me THANKS in ADVANCE.. :)

2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by CSloan7597
1

You just want to print something 10 times?

How about an if statement which sets a previously empty string with the relevant message
And then a while loop/forloop to print that string variable 10 times?

Something like

String message = "";

 if(ave>=75) 
     System.out.println("REMARKS:PASSED");
     message = "congratulations!";
 else 
     System.out.println("REMARKS:FAILED"); 
     message = "work harder";


     // loop here

I don't want to give it all away but that would work if I understand your question right :s

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.