Homework 3
Part A
☑ Create a Java project. In a main method do exercises 6.16 (isMultiiple method) and 6.19 (square of character, includes 6.18) from the Deitel textbook, (for 6.19 you can just use a String instead of a char). The text talks about reading in a character from the user, instead, test both of these methods from the same main by calling them with various different parameter values. In this case, try to think of different values that might be passed in and make sure that your methods have reasonable results for all the possibilities you can think of.
Part B
Add a new class Product, which has a name, a unit price, a number of units, and a boolean volumeDiscount.
Provide a method to return the total price based on the unit price and number of units.
if volumeDiscount is true, if there are more than 10 units, the total price is 10% lower.
Provide a method combo, which takes another Product and returns a new Product whose name is a combination of the two products, unit price is the sum of the two prices -5%, number of units are the sum of the two,
and has a volume discount if either of the two others are discounted.
Provide a method expensive which takes another Product, and returns whichever is more expensive based on the total price.
In a new class with main, create a method that reads in information about a Product and returns the Product. In main, ask the user how many products there are, and then using this method, read their info in. At the end, create a combo from the most expensive and least expensive (based on total price) Products, and show the combo to the user. In this case, you can assume that the user will always give you reasonable input values.
After you submit, remember to download your zip from blackboard, unzip it, and drag the unzipped directory to netbeans to make sure you submitted what you intended.