Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Refactoring Databases Evolutionary Database Design

Authors: Scott Ambler, Pramod Sadalage

1st Edition

0321774515, 978-0321774514

More Books

Students also viewed these Databases questions

Question

3. Outline the four major approaches to informative speeches

Answered: 1 week ago

Question

4. Employ strategies to make your audience hungry for information

Answered: 1 week ago