Design programs that leverage switch and case logic

Assignment Help JAVA Programming
Reference no: EM132323612

Programming and Problem Solving Lab Assignment - Selection Structures

Assignment Outcomes - By completing this assignment, students will be able to:

1) Structure programs to include conditional logic.

2) Write code that includes if/else statements.

3) Design programs that leverage switch/case logic.

4) Solve problems of increasing complexity.

Program 1: Back in my Day! Kids who grew up in the late 70s didn't have a lot of options for video games, but they did have "Choose your own Adventure" books. These books were cool and let the reader make meaningful decisions. If they chose choice "A", they would turn to a page of the book and continue their adventure. If they chose choice "B", they would turn to a different page and read a different adventure. Your task is to design (pseudocode) and implement (source code) for a story that has four different outcomes based on two different user inputs. See appendix for checking string equality.

Sample run 1:

It is a dark and stormy night. Do you want to take an umbrella? (Y/N): Y

Good - you have an umbrella.

You start to walk down a path and hear a scream. You realize that the person screaming is YOU because you see a wolf! Do you fight with your umbrella or run? ((F)ight/(R)un): F

You take out your umbrella and jab it into the wolf's paw! It runs away and you live another day.

Sample run 2:

It is a dark and stormy night. Do you want to take an umbrella? (Y/N): Y

Good - you have an umbrella.

You start to walk down a path and hear a scream. You realize that the person screaming is YOU because you see a wolf! Do you fight with your umbrella or run? ((F)ight/(R)un): R

You begin running so fast, the umbrella opens and you fly away like Mary Poppins. You're a little embarrassed, but you see the wolf fading off in the distance.

Sample run 3:

It is a dark and stormy night. Do you want to take an umbrella? (Y/N): N

You decide not to take an umbrella.

You start to walk down a path and hear a scream. You realize that the person screaming is YOU because you see a wolf! Do you fight with your umbrella or run? ((F)ight/(R)un): F

You begin fighting the wolf only to realize you had just eaten a McGrease® meal earlier. You fall dead from rigorous exercise, having had a heart attack.

Sample run 4:

It is a dark and stormy night. Do you want to take an umbrella? (Y/N): N

You decide not to take an umbrella.

You start to walk down a path and hear a scream. You realize that the person screaming is YOU because you see a wolf! Do you fight with your umbrella or run? ((F)ight/(R)un): R

Are you serious? You can't outrun a wolf! The wolf catches you and you are somewhat relieved because you don't have to worry about that Calculus exam...

Program 2: Your friends at McHamberger need your McHelpTM again. As part of their new marketing campaign, they are considering selling "rollable grease" and plan on having Harrison Ford say "Roll me some grease, Chewie!" in a commercial. The grease will be packed in either a sphere or a cylinder. For an unknown reason, the cylinder must be exactly 15 centimeters high (but you suspect it is because they are making a deal with RedToro, an up-and-coming energy drink). They want to have a program that, given a specified radius, calculates the volume of each container and determines which one has more volume. Design (pseudocode) and implement (source) this program. See the appendix for the formulas.

Sample run 1:

Enter the radius: 1

Cylinder volume: 47.12388980384689

Sphere volume: 4.1887902047863905

You can put more grease in the cylinder!

Sample run 2:

Enter the radius: 7

Cylinder volume: 2309.070600388498

Sphere volume: 1436.755040241732

You can put more grease in the cylinder!

Sample run 3:

Enter the radius: 12

Cylinder volume: 6785.840131753953

Sphere volume: 7238.229473870883

You can put more grease in the sphere!

Program 3: Καλημερα! For this program, you'll use a switch statement to implement a simple language translator. You must translate a minimum of the following words into a language of your choice (perhaps Klingon?): "Hello", "Goodbye", "food", "water", "where is", "I want". Your task is to design (in pseudocode) and implement (in source code) a program that reads in a word/phrase in English and prints that word/phrase out in another language. If the word is not available, you must let the user know.

Sample run 1:

Enter a word or phrase: Food

Φαγητo

Sample run 2:

Enter a word or phrase: Where is

Που εìναι

Sample run 3:

Enter a word or phrase: McGreaseTM

I cannot translate that word

Program 4: In 1789, Benjamin Franklin is known to have written "Our new Constitution is now established, and has an appearance that promises permanency; but in this world nothing can be said to be certain, except death and taxes." Our federal tax system is a "graduated" tax system which is broken into seven segments. Essentially, the more you make, the higher your tax rate. For 2018, you can find the tax brackets here. Your task is to design (pseudocode) and implement (source code) a program that asks the user for a salary and calculates the federal tax owed. Note, that only the money above a particular tax bracket gets taxed at the higher rate. For example, if someone makes $10,000 a year, the first $9525 gets taxed at 10%. The "excess" above that ($475) gets taxed at 12%. Note: work through at least three (3) examples of this by hand before designing the code. It will save you significant time. Still having problems? Have you talked to a GTA recently?

Sample run 1:

Enter your salary to the nearest dollar: 2000

Total tax owed is: $200

Sample run 2:

Enter your salary to the nearest dollar: 40000

Total tax owed is: $4739

Sample run 3:

Enter your salary to the nearest dollar: 100000

Total tax owed is: $18289

Submission -

Part 1: Pseudocode:

1. Review the assignment submission requirements and grading guidelines.

2. Upload the pseudocode files (Word doc or PDF) to the assignment submission folder in D2L.

3. The files must be uploaded to D2L by the due date.

Part 2: Source Code:

1. Review the assignment submission requirements and grading guidelines.

2. Upload the source code files to the assignment submission folder in D2L.

3. The files must be uploaded to D2L by the due date.

Attachment:- Assignment File.rar

Verified Expert

This assignment if of Java programming which is used to demonstrate the use of selection structure i.e. if, if-else, if-else if - else , and switch - case in the four programs.

Reference no: EM132323612

Questions Cloud

Describe the price elasticity of supply or demand : Describe the price elasticity of supply or demand for your product or service. Explain how two nonprice factors impact the demand of your chosen product
What is the leadership paradox : What is the leadership paradox? Give some reasons why a leader can encounter difficulty in newly formed teams or groups using a participative management system.
How does the united states benefit : How does the United States benefit by being the world currency reserve?
Prodcution possibilites frontier : Moving from one point to another along a given prodcution possibilites frontier, producing more of one good requires that?
Design programs that leverage switch and case logic : Kennesaw State University - CSE 1321L Programming and Problem Solving Lab Assignment - Selection Structures. Design programs that leverage switch and case logic
Unexpectedly good harvest of corn : Suppose an unexpectedly good harvest of corn occurred in 2019. Using a properly labeled aggregate demand and aggregate supply graph
Instructions review processes of invention and innovation : Discuss how you could apply the concepts learned in this course to your current or future career. Instructions Review the processes of invention and innovation.
What leadership theories that geisha williams : What leadership theories that Geisha Williams has while leading 500 companies. Explain, examples
Warren buffett is known to be an open-minded ceo : Warren Buffett is known to be an open-minded CEO, allowing his employees to offer their own input on what direction the company should take.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd