Question: import javax.swing.JOptionPane; class Main { public static void main(String[] args) { int testScore; // Numeric test score String input; // To hold the user's input
import javax.swing.JOptionPane;
class Main {
public static void main(String[] args) {
int testScore; // Numeric test score
String input; // To hold the user's input
// Get the numeric test score.
input = JOptionPane.showInputDialog("Enter your numeric " +
"test score and I will tell you the grade: ");
testScore = Integer.parseInt(input);
// Display the grade.
if (testScore < 60)
JOptionPane.showMessageDialog(null, "Your grade is F.");
else if (testScore < 70)
JOptionPane.showMessageDialog(null, "Your grade is D.");
else if (testScore < 80)
JOptionPane.showMessageDialog(null, "Your grade is C.");
else if (testScore < 90)
JOptionPane.showMessageDialog(null, "Your grade is B.");
else if (testScore <= 100)
JOptionPane.showMessageDialog(null, "Your grade is A.");
else
JOptionPane.showMessageDialog(null, "Invalid score.");
System.exit(0);
}
}
1) Redo this as a SWITCH STATEMENT
2) Ask the user to provide a week's worth of high temperatures. You program will output the data in one line, in fields with 10 spaces, with 2 decimals of precision. It will also display the week's average high temperature and the day with the highest high temperature.
3) Ask the user to input an employee name, hours worked, base pay, overtime multiplier (time and a half, double time...), and tax rate. Use decision structures to determine if OT is calculated. Then, output the weekly earnings as gross and net pay. Format the output to 2 decimals.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
