Find Us On: Facebook Twitter Rss Feed Blog
Need To Register? Sign Up Login

Java - Farmers Market

khrobinson48
khrobinson48 


Farmers Market: Write a Java program to perform check-out functionality for a simple Farmers Market store with exactly 5 products: Product - Price per pound Bananas - $ 0.44 Apples - $ 0.99 Cucumbers - $ 1.19 Carrots - $ 0.89 Oranges - $ 0.79 After getting the weight for each product purchase and compute & output the total purchase amount in the end. Do not use loops or arrays in this assignment. You can assume that all the user inputs are valid & the user will enter 0 for products (s)he does not purchase – no need to do any input validation explicitly. Use meaningful variable names & achieve "self-documenting" style of coding. Let us expand Farmersmarket.java program to apply discounts. Share your program in the forum and explain how you did it so that others can benefit from it. Farmers market introduces two types of discounts to attract more customers and make each customer to purchase more. Discount card program to attract customers. All customers who have signed up for it are considered as "special customers" and they get automatic minimum 10% discount off based on the total purchase amount. However, this cannot be combined with other discounts. All customers are eligible for the following discount program. If the total purchase is above $50, 5% discount will apply. If the total purchase exceeds $75, 10% discount will apply. If the total purchase exceeds $100, 15% discount will apply. After computing the total purchase amount, program should determine the discount & output the following items if a discount is applied: discount % and discount amount discounted total Attachments
Tags Clarifications

Answers

Java - Farmers Market - Solution

dickersonka
dickersonka 



Attached is the solution to the Java - Farmers Market assignment including source and comments Attachments
FarmersMarket.java (2 K) Download Preview
+ format.format(discountedTotal)); } /** * Gets weight of item * @param input Scanner for input * @param itemName Item name to get weight of * @return Item weight */ private static double getWeight(Scanner input, String itemName){ //Prompt for item weight

FarmersMarket_screenshot.png (7 K) Download Preview

Screenshots
Screenshot
Purchase Answer

Farmer Market Java - Solution

mariobeka
mariobeka 



Below you will find the source code of FarmerMarket.java Attachments
FarmerMarket.java (3 K) Download Preview
" + discountPer + "%"); double totalDiscount = totalAmount * discountPer; System.out.println("Total saved $" + totalDiscount); double total = totalAmount - totalDiscount; System.out.println("Your total purchase amount is $" + total); System.out.println("Have a nice day!"); } else { if (totalAmount > 100) { System.out.println("subTotal $" + totalAmount); double discountPer = .15;

Screen Shot 2014-05-07 at 3.39.27 PM.png (30 K) Download Preview

Screenshots
Screenshot
Purchase Answer