Jimmy and Jenna want to start making 3D models of kitties to sell. They need a way
Question:
Jimmy and Jenna want to start making 3D models of kitties to sell. They need a way to compute the selling price of the finished products. Your newfound C# knowledge of methods should be perfect for helping them. The model size can range from 2 to 10 inches, and the production cost is directly related to the model's size. The cost is computed as follows:
Size A1.3 + 2 *Size + 5
(for instance, a 3-inch kitty would cost 3 A 1.3 + 2* 3 + 5, or $15.17. They mark up their models by 50% when they sell them so that this 3-inch model would sell for $22.76. The program needs to include THREE programmer-defined methods:
- The first should be a type int method that reads the size of the kitty. Your method should restrict/limit the size to 2 to 10 inches, inclusive. Your method should prompt the user to enter a value and check it against the range allowed. If the value is acceptable, return it. Otherwise, keep prompting the user for values until they enter a valid measurement.
- The second (ComputeCost) should accept an integer size for the kitty to be made and return the production cost.
- The third method (ComputePrice) should accept the production cost returned from the first method and compute the selling price of the model.
Your output should be something like: Model Kitty - 3 inches - Cost: $15.17, Selling Price: $22. 76
Hint: use Math.Pow(a,b) to raise to compute a Ab power.
CHALLENGE: Modify your ComputePrice method to round up so the price ends in .99, so for instance, the output from the above example would be: Model Kitty - 3 inches - Cost: $15. 74, Selling Price: $23.99