Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

MODULE Three: Java Fundamentals Homework These homework assignments are designed to test your understanding of this module, if-else statement, and switch statement to solving

imageimageimageimageimageimageimageimageimage

MODULE Three: Java Fundamentals Homework These homework assignments are designed to test your understanding of this module, if-else statement, and switch statement to solving basis programming issue. If you have any problems getting through with this assignment, do not hesitate to contact your instructor. Type in/Save/Compile/Execute and submit screenshot and .java file Checkpoints: 3.1 Write an if statement that assigns 0 to x when y is equal to 20 If you cannot see help on follow Solution 3.1: int y=20; int x=30; if(y==20) x=0; Page System.out.println("The value of x is "+x); Make java program with the above code compile/run and get screenshot of all your IDE. 1 > of 9 ZOOM + public class lab_03_01 { public static void main(String[] args) { int y=2=0; int x=30; } if(y==20) x=0; System.out.println("The value of x is "+x); Page Assign 3.3: Write a program with if statement that assign 0.2 to commission if sales is gather than or equal 1000 and print out result to output. If you cannot see help on follow Solution: 2 > of 9 ZOOM + public class lab_03_03 //It is case sensitive { Page public static void main (String [] args) double commissions -0; int sales -1000; if( commissions >=1000) commissions =0.2; System.out.println (commissions); { Assign 3.4: Write a program with if statement that set the variable Fees to 50 if the Boolean variable max is true and print out result to output. If you cannot see help on follow Solution: 3 > of 9 ZOOM + public class Lab_03_4 //It is case sensitive { public static void main (String [] args) { int fees-0; bool max=true; } if (maz) fees =50; System.out.println (fees); Write a program that determined what day you have in mind when you type the first character of day; Monday through Wednesday. If you cannot see help on follow Solution: Page 4 > of 9 ZOOM + public class Lab3_8 //program name is case sensitive { public static void main(String [] args) { System.out.println("Type the first character of day; Monday through Wednesday "+ I tell you which day you have in your mind"); char mych='W'; switch (mych) { case 'M': System.out.println("You type first char of Monday"); break; case 'T': System.out.println("You type first char of Tuesday"); break; case 'W': System.out.println("You type first char of Wednesday"); break; default: System.out.println("The Char you type isnot on my list"); } 3 If you have extra time, please practice the following. no credit Page I 5 > of 9 ZOOM + Page Like the assign 31.1 to 3.4, write a sample program for page 1 checkpoints option 3.5 through 3.7 on the above checkpoint list on page 1 and submit your work. Assign 3.13: Given a variable score of type int, that has already been declared and initialized, write one if/else-if/else statement that will: Output the message "Error: Test was not taken" if the score variable is equal to 0. Output the error message "Error: Score is not valid" if the value stored in the score variable is NOT between 0 and 100 (e.g., outside the range of 0 and 100; less than 0 or greater than 100). If the value stored in the score variable is between 1 and 100 (inclusive), the program will output the message "Your score is: XX", where XX is the actual score stored in the variable score 6 > of 9 ZOOM + public class Lab_03_13//It is case sensitive { public static void main(String [] args) { int score=80; if (score == 0) System.out.println ("Error: Test was not taken"); else if (score < 0 || score> 100) System.out.println("Error: Score is not valid"); else if (score >=1 II score >=100) System.out.println("Your Score is:" + score) ; } } Assign Lab 03 16 Choose the switch statement that tests the value in the character variable response and then performs the following actions: If value in response variable is 'y' or 'Y', then print "Your request is processed." If value in response variable is 'n' or 'N', then print "Your request rejected" For all other values in the variable response, print "Invalid entry." Page 7 of 9 ZOOM + 1)- Write a program to calculate an employees pay by using if else statement, with Given following variables. int hours -50; int overtime=0; int PayRate-15; double overtimeRate-1.5; If you cannot do it, see the following help. public class lab_03_02//It is case sensitive { public static void main(String [] args) { int hours = 50; int overtime=0; int PayRate=15; double overtimeRate=1.5; if (hours>50) { // Pay Formula $40*15 + (50-40) * $15 overtime -hours- 40; System.out.println ("Pay is "+40*PayRate+overtime PayRate*overtimeRat); } else System.out.println ("Pay is "+hours*PayRate); } }//the output is 750 int hours =50; int overtime=0; int PayRate=15; double overtimeRate-1.5; *1.5 Page 8 > of 9 ZOOM + 3.4 Checkpoint 3.1 Write an if statement that assigns 0 to x when y is equal to 20. 3.2 3.3 Write an if statement that multiplies payRate by 1.5 if hours is greater than 40. Write an if statement that assigns 0.2 to commission if sales is greater than or equal to 10000. Write an if statement that sets the variable fees to 50 if the boolean variable max is true. 3.5 3.6 3.7 Page 9 Write an if statement that assigns 20 to the variable y and assigns 40 to the vari- able z if the variable x is greater than 100. Write an if statement that assigns 0 to the variable b and assigns 1 to the variable if the variable a is less than 10. Hint: Use the following help if you have difficulty to write a program for above problem: Write an if statement that displays "Goodbye" if the variable myCharacter con- tains the character 'D'. of 9 ZOOM +

Step by Step Solution

3.35 Rating (142 Votes )

There are 3 Steps involved in it

Step: 1

Heres how you can create a Java program based on the given code public cl... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Microeconomics An Intuitive Approach with Calculus

Authors: Thomas Nechyba

1st edition

538453257, 978-0538453257

More Books

Students also viewed these Programming questions