Answered step by step
Verified Expert Solution
Question
1 Approved Answer
5. What is the output of the following code? public class ScoreTest { public static void main(String[] args) { double IELTSTotal=26; double score = 10*IELTSTotal/40;
5. What is the output of the following code?
public class ScoreTest {
public static void main(String[] args) { double IELTSTotal=26;
double score = 10*IELTSTotal/40; switch((int)score)
{
case 10:
case 9:
case 8:
case 7:
System.out.println("You are accepted! "); break;
case 6:
case 5:
case 4:
case 3:
case 2:
case 1:
case 0:
System.out.println("You are not accepted!"); break;
default:
System.out.println("Error! Please try again!"); }
} }
[3 marks]
Computing 1 Coursework 2 Questions
6. Write a program to extend the code given in question 5.
a. Your program should take IELTSTotal as an input through the keyboard.
b. Your program will continue to accept input and display the outcome until user
enters "n" key for "Do you want to continue? y" prompt.
Step 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