Elite Coders Society
Hello Guest!
Join us here in this forum!
Please Log in or Register to access more feature in this site.
Start Learning!

† Copyright ©️ 2011 - EliteCoders.forumotion.com †

Start sharing and learning new skills about programming and design by building connections with other professional and students.
HomeForumPortalCalendarGallerySearchRegisterLog in
Elite Coders Partner Links

EliteCoders™️ News!
Hello Guest!, Welcome in our forum. Be active!

Share | 

 Cashier Java

View previous topic View next topic Go down 
Forum Owner
Forum Owner

Posts : 78
EC-Points : 6304
Thanked : 21
Join date : 15/10/2011
Age : 23
Location : Philippines

Hacker's Info
Hacking Exp:
0/0  (0/0)
Hacker Type: White Hat
Hacking Title:

PostSubject: Cashier Java   Fri Nov 25, 2011 11:09 am

import java.util.*;
public class Cashier
double cost;
double tax;
double payment;
public static void main(String[] args)
 Cashier app = new Cashier();
 Scanner input = new Scanner(System.in);
 System.out.println("Please enter item cost: ");
 String i = input.nextLine();
 System.out.println("The original cost of the item is: " +app.getCost());
 System.out.println("The 6% sales tax of the item is: ");
 app.setTax(app.getCost() * 0.06);
 System.out.println("The total cost of the item is: " +(app.getCost() + app.getTax()));
 System.out.println("Enter the amount paid by the costumer: ");
 i = input.nextLine();
 if(app.getPayment() < app.getCost()+app.getTax())
 System.out.println("Your payment is not enough");
 double change = app.getPayment() - (app.getCost()+app.getTax());
 System.out.println("Your change is: " + change);
double getCost()
  return cost;
double getTax()
  return tax;
double getPayment()
  return payment;
void setCost(double cost)
  this.cost= cost;
void setTax(double taxRate)
void setPayment(double payment)
  this.payment = payment;
Back to top Go down
View user profile

Cashier Java

View previous topic View next topic Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
Elite Coders Society :: Software Development :: Java Programming :: Object-Oriented Programming (OOP) Java-

Protected by Copyscape Duplicate Content Finder
Powered By EliteCoders™

Elite Coders Partner Links
GreyPhantomYour Link HereYour Link HereYour Link Here