Question 1

You will enter the on hand and the cost.

Inventory value is the on hand multiplied by the cost.

Stocking fee is calculated as follows:

  • If the value is greater than 500 it is 6% (.06)
  • If the value is greater than or equal to( >= ) 100 and less than or equal to ( <= ) 500 it is 4% (.04)
  • If the value is less than 100 it is 2% (.02)

Format everything to 2 decimals except the on hand has no decimals.

Allow the user to run it as many times as they want but entering a y (this is first loop).

Print the "ERROR on hand is invalid!" if the onhand is less than 1 OR greater than 1000 and then allow them to re-enter the on hand (this is the second loop).

Sample output:

Enter the amount of stock on hand 100
Enter the cost price 5.50

The on hand is 100
The cost is 5.50
The value is 550.00
The stocking fee is 33.00

Do you want to enter another item? y


Enter the amount of stock on hand 100
Enter the cost price 3.78

The on hand is 100
The cost is 3.78
The value is 378.00
The stocking fee is 15.12

Do you want to enter another item? y


Enter the amount of stock on hand 100
Enter the cost price .89

The on hand is 100
The cost is 0.89
The value is 89.00
The stocking fee is 1.78

Do you want to enter another item? y


Enter the amount of stock on hand 5000

ERROR on hand is invalid!
Enter the amount of stock on hand

Question 2

Create a code that is able to look identical to the output example shown below when the program is ran:

Enter your guess between 1-100 75
Too low, try again
Enter your new guess 89
Too high, try again
Enter your new guess 79
Too low, try again
Enter your new guess 84
Too high, try again
Enter your new guess 82
Too high, try again
Enter your new guess 81

You are a winner!
It took you this many guesses 6
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.