Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1) Create a method called whatTypeOfPedalCycle() The method should take an int. The method should return a String based on the int that was provided.

1)

Create a method called whatTypeOfPedalCycle() The method should take an int. The method should return a String based on the int that was provided. If the int is 1, return unicycle, if the int is 2 return bicycle, and if the int is 3 return tricycle. If the int is anything else, return error. Solve this problem using any conditional structure of your choice. Use the method in your main method at least 5 times: proving that 0 is error, 1 is unicycle, 2 is bicycle, 3 is tricycle, and 4 is error. Remember that the sysouts should be in the main method, not in whatTypeOfPedalCycle()! 2) Implement a method isPass(int grade). The method takes an int and returns a boolean. If the int is greater than or equal to 70, return true. If not, return false. Use 1 ternary operation for this method. Use the isPass() method in your main method at least twice to demonstrate one true and one false example. 3) Implement a method printPay(double wage, int hours). It takes a wage in the form of a double (like 17.50) and hours worked as int. Use printf to output the wage, hours paid, and total pay in the following format: $17.50 x 5 = $87.50 The dollar signs are strings, the x is a string, and the = is a string. The 17.50 is the double wage to 2 decimal spaces (%.2f), the 5 is the hours as an integer (%d), and the 87.50 is hours * wage, also as a double (%.2f). Remember that this is a method. It takes variables. None of those numbers are fixed. The only fixed parts are the strings mentioned. Everything else is variable. Use it in your main method at least once.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

MySQL/PHP Database Applications

Authors: Brad Bulger, Jay Greenspan, David Wall

2nd Edition

0764549634, 9780764549632

More Books

Students also viewed these Databases questions