Question: Write a program in Java that First, you need a blueprint named Planet.java in a package named model1. Include the following fields. Make certain that
Write a program in Java that First, you need a blueprint named Planet.java in a package named model1. Include the following fields. Make certain that your blueprint has two constructors, a toString() method, and your getters and setters.
plantName
seedCost cost per package of seeds
numPack how many seed packs you want
Add a method named cost() that takes no parameters and returns the seedCost * numPack.
Add a method named net() that calculates the net cost. It should give them a 10 percent discount if they purchase more than six packages of seeds. (this should take no parameters and return a double)
Next write a blueprint program named PlantDriver.java. The program should:
- Ask the user for the name of the plant, the cost of a package of seeds, and how many packages they wish to purchase.
- Using the full constructor, create a Plant instance.
- Call your toString() method on that object to print out the results.
- Call the cost() method on that object to print out the cost of the order
- Call the net() method on that object to print out the net cost for of the order.
- Calculate the shipping cost from the table below
- Print out the total cost (net() + shipping) for the order
Shipping Chart (Hint - use an if/else here!) Order Subtotal $0.01 - $10.00 $10.01 -$30.00 $30.01 - $50.00 $50.01 and over U. S. Shipping Charges $4.00 $6.75 $10.00 FREE Sample Output What type of seeds do you want? (ex beans, cor, etc) com How much does a packet of seeds cost? 3.00 How many seed packets do you want? 25 You bought 25 packs of corn seeds which cost $3.00 per pack The cost is $75.00 Your net amount with your discount is $67.50 Your shipping cost is $0.00 The total cost of your order is $67.50 Run #2 What type of seeds do you want? (ex beans, com, etc) squash How much does a packet of seeds cost? 4.50 How may seed packets do you want? 4. You bought 4 packs of squash seeds which cost $4.50 per pack The net cost is $18.00 Your net amount with your discount is $18.00 Your shipping cost is $6.75 The total cost of your order is $24.75
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
