SOLVED: Assignment3

25.00 $

Category:
Click Category Button to View Your Next Assignment | Homework

You'll get a download link with a: rar solution files instantly, after Payment

Securely Powered by: Secure Checkout

Description

5/5 - (3 votes)

1. Rewrite the following set of if statements using a nested if-else structure. if (score = 90) grade = ‘A’; if (score = 80 && score < 90) grade = ‘B’; if (score = 70 && score < 80) grade = ‘C’; if (score = 60 && score < 70) grade = ‘D’; if (score < 60) grade = ‘F’; 2. Rewrite the following nested if-else statement as an equivalent switch statement. if (letter == ‘A’ | | letter == ‘a’) System.out.println(“Excellent”); else if (letter == ‘B’ | | letter == ‘b’) System.out.println(“You can do better”); else if (letter == ‘C’ | | letter == ‘c’) System.out.println(“Try harder”); else if (letter == ‘D’ | | letter == ‘d’) System.out.println(“Try much harder”); else System.out.println(“Try another major! “); Write a program called Assignment3 (saved in a file Assignment3 .java) that asks a user to enter two strings. First, the program prompts: Please enter a string. The program should read in the string, and prompts: Please enter another string. The program reads in the string and performs the following: ï‚· checks if each string’s length is odd or even. ï‚· checks if two strings are same or different. ï‚· checks which string is lexically larger, or they are same. ï‚· prints out the first character (index 0) of each string ï‚· prints out a new string consisting of the first string concatenated (appended) with the second string. ï‚· prints out two strings using upper case letters. Here is the output your program should produce when the user enters the string shown in bold:

  • Assignment3.rar