Question

In: Computer Science

Read and understand the pseudocode of problem R2.19 in java from the end of chapter 2...

  1. Read and understand the pseudocode of problem R2.19 in java from the end of chapter 2 in your textbook. In a Java class named WeekDays, write a java program that reads an input int between (0-6), and displays the corresponding day for that given input as below:

Enter a number (0-6): 2

** 2 is Tue **

!!! NO if-else conditions

Solutions

Expert Solution

import java.util.Scanner;

public class WeekDays {
    public static void main(String[] args) {
        int n;
        Scanner scan = new Scanner(System.in);
        System.out.print("Enter a number (0-6): ");
        n = scan.nextInt();

        switch (n){
            case 0:
                System.out.println("** 0 is Sum **");
                break;
            case 1:
                System.out.println("** 1 is Mon **");
                break;
            case 2:
                System.out.println("** 2 is Tue **");
                break;
            case 3:
                System.out.println("** 3 is Wed **");
                break;
            case 4:
                System.out.println("** 4 is Thur **");
                break;
            case 5:
                System.out.println("** 5 is Fri **");
                break;
            case 6:
                System.out.println("** 6 is Sat **");
                break;
            default:
                System.out.println("Invalid input");
        }
    }
}


Related Solutions

2. Problem 2 is adapted from the Problem 39 at the end of Chapter 11. Please...
2. Problem 2 is adapted from the Problem 39 at the end of Chapter 11. Please solve this problem in Excel and submit your Excel spreadsheet. The problem is as follows: The state of Virginia has implemented a Standard of Learning (SOL) test that all public school students must pass before they can graduate from high school. A passing grade is 75. Montgomery County High School administrators want to gauge how well their students might do on the SOL test,...
This is an intro to java question. Please answer with pseudocode and code. Problem 2: RSA...
This is an intro to java question. Please answer with pseudocode and code. Problem 2: RSA Public Key (10 points) (Cyber Security) RSA is an asymmetric encryption scheme, where a public key is used to encrypt data and a different, private key decrypts that data. RSA public/private keys are generated from two prime numbers, typically very large ones. The idea behind RSA is based on the fact that its difficult to factorize very large integers. RSA public key generation is...
This is an intro to java question. Please post with pseudocode and java code. Problem should...
This is an intro to java question. Please post with pseudocode and java code. Problem should be completed using repetition statements like while and selection statements. Geometry (10 points) Make API (API design) Java is an extensible language, which means you can expand the programming language with new functionality by adding new classes. You are tasked to implement a Geometry class for Java that includes the following API (Application Programming Interface): Geometry Method API: Modifier and Type Method and Description...
Please read Financial Statement Analysis Case 2: Wiebold in the end of chapter materials in the...
Please read Financial Statement Analysis Case 2: Wiebold in the end of chapter materials in the e Text. Answer questions a) b) & c) listed under Instructions. Please post your answer and respond to at least two of your classmates. Case 2: Wiebold, Inc. The following note related to stockholders' equity was reported in Wiebold, Inc.'s annual report. On February 1, the Board of Directors declared a 3-for-2 stock split, distributed on February 22 to shareholders of record on February...
The purpose of this assignment is to read and understand the difference between front end and...
The purpose of this assignment is to read and understand the difference between front end and back end design of a database application. Steps: Search for articles describing front end and back end design of any application (example, a website). Summarize the concepts and elements for each one. Does the database that holds all the data exist at the front end or the back end? Include the answer in your report.
Intro to java Problem, Please provide code and Pseudocode. Not able to compile correct numbers. Problem...
Intro to java Problem, Please provide code and Pseudocode. Not able to compile correct numbers. Problem 7: Simple Calculator (10 points) (General) Calculators represent the most basic, general-purpose of computing machines. Your task is to reduce your highly capable computer down into a simple calculator. You will have to parse a given mathematical expression, and display its result. Your calculator must support addition (+), subtraction (-), multiplication (*), division (/), modulus(%), and exponentiation (**). Facts ● Mathematical expressions in the...
Unit 1 Discussion Forum 2: Transforming Leaders. Read the case at the end of Chapter 1...
Unit 1 Discussion Forum 2: Transforming Leaders. Read the case at the end of Chapter 1 on Transforming Leaders. Respond to the discussion questions at the end of case to frame your post. You don't need to answer every question, but use them to guide your responses in the case analysis. The case is also listed below: Cameryn is the vice president for professional development at a large metropolitan hospital in the Midwest. She has been in her role for...
This is an Intro to java question. Please provide code and pseudocode for better understanding. Problem...
This is an Intro to java question. Please provide code and pseudocode for better understanding. Problem 4: Player Move Overworld (10 points) (Game Development) You're the lead programmer for an indie game studio making a retro-style game called Zeldar. You've been tasked to implement the player movement. The game is top-down, with the overworld modeled as a 2d grid. The player's location is tracked by x,y values correlating to its row and column positions within that grid. Given the current...
This is an Intro to Java Question, Please respond with code and pseudocode. Problem 3: RSA...
This is an Intro to Java Question, Please respond with code and pseudocode. Problem 3: RSA Private Key (10 points) (Cyber Security) In the RSA algorithm, encrypting and decrypting a message is done using a pair of numbers that are multiplicative inverses with respect to a carefully selected modulus. In this task, you must calculate the modular multiplicative inverse for given set of values. What is the Modular Multiplicative Inverse? In mathematics, each operation typically has an inverse. For example,...
2. Write a Java program to read a string (a password)from the user and then   check...
2. Write a Java program to read a string (a password)from the user and then   check that the password conforms to the corporate password policy.   The policy is:   1) the password must be at least 8 characters   2) the password must contain at least two upper case letters   3) the password must contain at least one digit   4) the password cannot begin with a digit   Use a for loop to step through the string.   Output “Password OK” if the password...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT