Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using switch statement, write Java program that will display the following options on screen: Help on: if statement ternary operator if..else statement Choose one: In

Using switch statement, write Java program that will display the following options on screen:

Help on: if statement

ternary operator

if..else statement

Choose one: In addition, the program should obtains the user’s selection. Based on the selection your program should do the following:

When option 1 is chosen, if, : -the program should prompt user for their name and age and display the name of the user and state whether the user is eligible for voting if their age is 18 years or more.

When option 2 is chosen, ternary operator, :- the program should prompt user for 2 integers and use a ternary operator to determine the maximum integer which should be displayed on the screen.

When option 3 is chosen, if...else statement, :- the program should prompt user for marks, integer whose value is between 0 and 100. The program will use if...else statement to determine the letter grade for that score based on the following criteria:

Grading Scale Score Grade 0-40 F 41-60 C 61-80 B 81-100 A

A good programmer ensures that their program has adequate comments.

Submission: Save the files as follows: 1.Notepad++/notepad saved as .java (Java files) with the java code. – this could be copied from your Eclipse/NetBeans or written in notepad Submit the file on or before the due date.


What will this small program output? class Main { } private static void foo(int x) { } System.out.println(x); public static void main(String[] args) { } int x = 15; foo(x); x = 18;

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

Java How To Program Late Objects Version

Authors: Paul Deitel, Deitel & Associates

8th Edition

0136123716, 9780136123712

More Books

Students also viewed these Programming questions

Question

identify the major consequences of burnout, boredom and engagement;

Answered: 1 week ago

Question

1. What is the purpose of hypothesis testing?

Answered: 1 week ago