MODULE Three: Java Fundamentals Homework These homework assignments are designed to test your understanding of this...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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 \n"+ 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 + 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 \n"+ 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 +
Expert Answer:
Answer rating: 100% (QA)
Heres how you can create a Java program based on the given code public cl... View the full answer
Related Book For
Microeconomics An Intuitive Approach with Calculus
ISBN: 978-0538453257
1st edition
Authors: Thomas Nechyba
Posted Date:
Students also viewed these programming questions
-
QUIZ... Let D be a poset and let f : D D be a monotone function. (i) Give the definition of the least pre-fixed point, fix (f), of f. Show that fix (f) is a fixed point of f. [5 marks] (ii) Show that...
-
Design a Java class that represents a cache with a fixed size. It should support operations like add, retrieve, and remove, and it should evict the least recently used item when it reaches capacity.
-
Implement a generic Map that supports the put and get operations. The implementation will store a hash table of pairs (key, definition). Figure 5.55 provides the Map specification (minus some...
-
When a missile is shot from one spaceship towards another, it leaves the first at 0.950c and approaches the other at 0.750c. What is the relative velocity of the two ships?
-
A parachutist bails out and freely falls 50 m. Then the parachute opens, and thereafter she decelerates at 2.0 m/s2. She reaches the ground with a speed of 3.0m/s. (a) How long is the parachutist in...
-
Define longitudinal and lateral strains.
-
The following transactions apply to Pecan Co. for 2018, its first year of operations: 1. Received $100,000 cash in exchange for issuance of common stock. 2. Secured a $300,000 five-year installment...
-
A wheel of 100 cm diameter, 1000 N weight is resting against a block of 25 cm height. Find minimum force P at angle 45 with horizontal when the wheel is just on the point of climbing the block. P...
-
On December 31, the trial balance indicates that the supplies account has a balance, prior to the adjusting entry, of $320. A physical count of the supplies inventory shows that $90 of supplies...
-
Read the assignment textbook, and search the internet to answer the following questions: 1. What is the purpose of materials management? 2. What are the responsibilities of capacity management? 3....
-
what are the benefits of a department having a vision, mission and value statement. 2 How deviations in vision, mission and values at different levels of government affect service delivery. 3. Which...
-
There are many mortgage types that a potential homeowner could consider. Select two of the mortgage types in the list below: Fixed Rate Adjustable Rate Mortgage FHA VA Balloon Mortgage Reverse...
-
Given the MONTHLY price information provided about 3 stocks and the market (SPY), what is the annualized Reward to Systematic risk ratio for your favorite stock (Treynor's Ratio)? Risk-Free Rate =...
-
Explain windows and UNIX file system permission model. Also compare the both models.?
-
Compare the following mortgage loans with respect to risk to the lender, risk to the borrower, and the level of interest rates that are likely to be charged to the borrower. Variable rate mortgages...
-
5.Susan buys a bond which will pay $120 in interest each year for 10 years, and at the end of the 10 years, she will receive the return of principal in the amount of $1,000. If the discount rate is...
-
Why is it important to understand the macro-environment when making decisions about an international retail venture?
-
Suppose the domestic demand and supply for corn intersects at p and suppose further that p also happens to be the world price for corn. (Since the domestic price is equal to the world price, there...
-
Consider my tastes for consumption and leisure. A: Begin by assuming that my tastes over consumption and leisure satisfy our 5 basic assumptions. (a) On a graph with leisure hours per week on the...
-
Suppose you and I consider the following game: We both put $y on the table, then flip a coin. If it comes up heads, I get everything on the table, and if it comes up tails, you get everything on the...
-
Show that in the case of a binary system in which the orbit is circular of radius \(r\), the kinetic energy corresponds to half the absolute value of the potential energy. In other words, the total...
-
Calculate the radius \(R_{S}\) of the orbit of a geostationary satellite using the lunar period, \(T=27.3\) d, and the Earth-Moon distance, \(D_{T L}=3.810^{5} \mathrm{~km}\), as data.
-
In the case of a gravitationally bound two-body system on an elliptical orbit in which there is energy dissipation as in the case of the question 4, explain why the system first tends to have a...
Study smarter with the SolutionInn App