Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

introduction to java my issue is with tracking the amount left on the card, as it pertains to number of purchases. D *Forloop.java D ClassNote.java

introduction to java

image text in transcribed

image text in transcribed

my issue is with tracking the amount left on the card, as it pertains to number of purchases.

D *Forloop.java D ClassNote.java 1 //Mike Greene Lab03Bithday CIS 2212 01/26/2019 D Giftcard.java Forgiftcard.java 8 5 package p3; 7 import java.util.Scanner; 8 public class Forgiftcard { public static void main(String[] args) { 10e 11 double balance = 225; 12 double price-0, rmainBal=0; 13 14 final int MAXITEM =6;//I forgot this the first few because c++ keeps seeping into my brain 15 int purchase = 0; Scanner input = new Scanner(System.in); 16 17 System.out.println("Happy Birthday!!"); 18 System.out.println("Today we have given you a $225 gift card for the mall"); 19 System.out.println("However for tax purposes (and just because we can, we are retail after all), you 20 System.out.println("ENJOY!!!!"); System.out.println("Your current balance is "+ balance); 21 System.out.println("Enter your first item"); 23 purchase input.nextInt(); 24 for (purchase0;purchase ++ ) { 25 026 27 28 } 29 30 31 22 purchase E Fit to page D Pag CIS 2212 Java Software Development I Happy Birthday! Due Tuesday, January 28, 2020 at 5:00 pm Lab 03 For your birthday, your rich aunt & uncle give you a $225 gift card to the local mall. They will go shopping with you and will help carry out your items. The most that each of you can carry is one item in each hand. Thus, you may purchase a maximum of six items. You will have a tracker device that computes the number of items you purchase as well as the amount of money you have spent. After you choose each item, the tracker prompts you for the price, and then displays the amount of money you have spent. Then it displays the number of items you may still choose and the balance on the gift card. The program will not terminate until you reach 6 items or $225, whichever comes first. The tracker then will list the total spent & the number of items as well as the balance on the gift card. Required: validate that negative prices are not entered and that you can't spend more than the balance on the gift card. Give the user as many opportunities as needed to enter a price above 0 or below 225. User should be able to purchase items costing between one penny and $225, inclusive. all dollar amounts should be formatted for currency using the NumberFormat class. Include at least 1 method in your program. Be sure to create test cases for all options: spend the entire dollar amount on fewer than 6 items purchase 6 items totaling less than the entire dollar amount spend the entire dollar amount on exactly 6 items Before starting this lab, be sure to refer to the "How to Submit Assignments" document in elearn for proper documentation, naming conventions, etc. Points may be deducted if submitted incorrectly

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts International Edition

Authors: David M. Kroenke

6th Edition International Edition

0133098222, 978-0133098228

More Books

Students also viewed these Databases questions