![alisonlebron15](/avatars/331.jpg)
alisonlebron15
14.12.2019 •
Computers and Technology
/* write a program that prompts the user to enter two characters and displays the major and status represented in the characters. the first character indicates the major and the second is number character 1, 2, 3, 4, which indicates whether a student is a freshman, sophomore, junior, or senior. suppose the following chracters are used to denote the majors: m: mathematics c: computer science i: information technology*/import java.util.scanner; public class exercise_04_18{ public static void main(string[] args) { scanner in = new scanner(system.in); system.out.print("enter two characters: "); string status = in.next(); char major = character.touppercase(status.charat(0)); char year = status.charat(1); string coursename = ""; string yearname = ""; if (major == 'm' || major == 'i' || major == 'c') { switch(major) { case 'm': coursename = "mathematics"; break; case 'c': coursename = "computer science"; break; case 'i': coursename = "information technology"; break; default: break; } switch(year) { case '1': yearname = "freshman"; break; case '2': yearname = "sophmore"; break; case '3': yearname = "junior"; break; case '4': yearname = "senior"; break; default: break; } system.out.printf("%s %s%n", coursename, yearname); } else{ system.out.printf("invalid input.%n"); } }}
Solved
Show answers
More tips
- H Health and Medicine Simple and Effective: How to Get Rid of Cracked Heels...
- O Other How to Choose the Best Answer to Your Question on The Grand Question ?...
- L Leisure and Entertainment History of International Women s Day: When Did the Celebration of March 8th Begin?...
- S Style and Beauty Intimate Haircut: The Reasons, Popularity, and Risks...
- A Art and Culture When Will Eurovision 2011 Take Place?...
- S Style and Beauty How to Choose the Perfect Hair Straightener?...
- F Family and Home Why Having Pets at Home is Good for Your Health...
- H Health and Medicine How to perform artificial respiration?...
- H Health and Medicine 10 Tips for Avoiding Vitamin Deficiency...
- F Food and Cooking How to Properly Cook Buckwheat?...
Answers on questions: Computers and Technology
- E English Which information can you find in print (hardcopy) dictionary? select all that apply....
- M Mathematics Positional number system where the value of a digit is determined by its location...
- S Social Studies A. Palitan ng pangngalang pantangi ang sumusunod na mga pangngala pambalana.1. gatas2. bata3. lalawigan4. bayani5. pangulo...
- M Mathematics What conclusion can be made for c and e ? A.c is greater than or equal to eB.c is less than or equal to e C.c is greater than e D.c is less than e ...
Ответ:
C++
Explanation: