subject

/* 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"); } }}

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 00:00
Sam is a data analyst at an advertising firm. he often uses a spreadsheet that contains media ratings details. he would like to filter the spreadsheet data based on different filter criteria. which operators can he use to specify the combination of filter criteria? sam can use the ( blank ) operators to specify a combination of filter criteria.
Answers: 3
question
Computers and Technology, 23.06.2019 01:00
Write the command that can be used to answer the following questions. (hint: try each out on the system to check your results.) a. find all files on the system that have the word test" as part of their filename. b. search the path variable for the pathname to the awk command. c. find all files in the /usr directory and subdirectories that are larger than 50 kilobytes in size. d. find all files in the /usr directory and subdirectories that are less than 70 kilobytes in size. e. find all files in the / directory and subdirectories that are symbolic links. f. find all files in the /var directory and subdirectories that were accessed less than 60 minutes ago. g. find all files in the /var directory and subdirectories that were accessed less than six days ago. h. find all files in the /home directory and subdirectories that are empty. i. find all files in the /etc directory and subdirectories that are owned by the group bin."
Answers: 1
question
Computers and Technology, 24.06.2019 02:20
Peter is thinking of a number which isless than 50. the number has 9 factors.when he adds 4 to the number, itbecomes a multiple of 5. what is thenumber he is thinking of ?
Answers: 1
question
Computers and Technology, 24.06.2019 11:20
Print "censored" if userinput contains the word "darn", else print userinput. end with newline. ex: if userinput is "that darn cat.", then output is: censoredex: if userinput is "dang, that was scary! ", then output is: dang, that was scary! note: if the submitted code has an out-of-range access, the system will stop running the code after a few seconds, and report "program end never reached." the system doesn't print the test case that caused the reported message.#include #include using namespace std; int main() {string userinput; getline(cin, userinput); int ispresent = userinput.find("darn"); if (ispresent > 0){cout < < "censored" < < endl; /* your solution goes here */return 0; }
Answers: 3
You know the right answer?
/* write a program that prompts the user to enter two characters and displays the major and status r...
Questions
question
History, 13.10.2020 01:01
question
Mathematics, 13.10.2020 01:01
question
Mathematics, 13.10.2020 01:01
question
Biology, 13.10.2020 01:01
question
Physics, 13.10.2020 01:01
question
Mathematics, 13.10.2020 01:01
question
History, 13.10.2020 01:01
question
Chemistry, 13.10.2020 01:01