Modified Cash Register - Allow User To Choose Preferred Bills

Feb 5, 2015

I am trying to create a slightly modified cash register. The user will enter the amount of the item, the payment received, calculate the change/refund, and then allow the user to choose the preferred bills.

import java.util.Scanner;
public class Register {
private static Scanner input;
public static void main(String[] args) {
input = new Scanner(System.in);
System.out.println("*****CASH REGISTER*****" );
System.out.print("Item Amount: " );
int amount = input.nextInt();

[Code] ....

I will try to clarify the code, to make things a little easier to interpret. in the refund method, I have set up a 2-d array to exist and function as an excel sheet. The refund amount is passed to the method and compared to each bill of the array. Once the refund is determined to be greater than a bill, the user is prompted to enter the preferred bill type. This is where my problem is...I would like the program to then calculate the number of bills and keep a tally of those bills in the 2nd column and then determine the new refund amount at which point the user will be prompted again to determine the desired bill.

Then print out the array of bills that are not equal to 0.

View Replies


ADVERTISEMENT

GUI Cash Register System For Saloon

Apr 12, 2014

Gui java cash register

I have to make cash register system for saloon. it will look like this but I dont know how to do it.

Example : if customer come to make a hair cut. I will click on c button and choose her hair length then the price will come out. Each hair length will have different price. The customer will give the money and the total will show the customer money and the balance will come out after the total is deduct with the price.

View Replies View Related

Cash Register - Using BigDecimal Instead Of Double

Jul 1, 2014

I wrote this one all by myself (AND it works!!), but I know that to get really accurate results I need to use BigDecimal instead of Double. The problem is that I can't quite figure out how to do that. How to switch those out?

import java.util.Scanner;
public class CashReg
{
public static void main( String[] args )
{
Scanner userInput = new Scanner(System.in);
String due;
String tend;

[Code] .....

View Replies View Related

JSP :: How To Access And Print Cash Register From Web Application

Jul 25, 2014

I have my own web application system now i want access a cash register machine from my web application to print receipt

View Replies View Related

Cash Register - Total Up Sales And Computes Change Due

Mar 4, 2015

I'm writing this super simple code as I follow along in this java textbook, and I don't know why it's giving me an error in my tester program!

CashRegister.java

public class CashRegister //a cash register totals up sales and computes change due
{
private double purchase;
private double payment; /**establishes instance variables "purchase" and "payment" and assigns them as doubles to store the
two amounts later on. the assignment as private makes it so ONLY methods in this class can access
these instance variables*/

[Code] .....

View Replies View Related

Cash Register Program For 5 Products Using Switch Or If Else Statement In Java

Dec 3, 2014

We're told to make a cash register program for 5 products using Java. It loops until "-1" is entered on the "Continue?" input dialog box.There should be a:

1. Main Menu - where the user will pick what to buy (one product at a time) like the sample code below and prompt the user if he will buy another product or not. If yes, the program will go back to the main menu to buy another product and if not, continue to the program. And it looks something like this: LEvFOwQ.png

2. Receipt - at the end of every transaction.

3. Daily Sales Report where it shows all receipts then grand total like:

Transaction 1

-subtotal

Transaction 2

-subtotal

and so on then,

GRAND TOTAL

4. Inventory Report where it shows the Items Available before the Selling, Items Sold, and Items Available after Selling in table format.

Below is the code for a simple cash register for only one product that I made but I need to upgrade it for it to work for 5 products. That code will serve as the basis for this program.make the switch or if-else statement for the main menu first and if I got it right I try doing the rest.

int userQty1 = Integer.parseInt(JOptionPane.showInputDialog(
"Product ID Product Name Product Quantity Product Price"
+prodID1 + " " +prodName1 + " " + prodQty1 + " " +prodPrice1 "
"
+ and so on until prod5));

[code].....

View Replies View Related

Cash Register Class Used With RetailItem Class

Apr 27, 2014

So I have to make a cash register class that can be used with a RetailItem class that I did in another assignment. It should simulate the sale of an item. It should have a constructor that accepts a RetailItem object as an argument, and the constructor should also accept an integer that represents the quantity of the items being purchased.

I have no errors but here is the output I am getting:

How many candy bars are you buying? 5
Subtotal : $0.00
Sales tax : $0.06
Total : $0.06
BUILD SUCCESSFUL (total time: 3 seconds)

The code I have so far below:

CashRegister Class
package cashregisterdemo;
public class CashRegister {
private RetailItem retailItem;
private int quantityItems;
private final double SALES_TAX = .06;
private int subTotal;

[Code] .....

View Replies View Related

HiLo Game In Java - User Can Choose Up To 3 Different Levels With 3 Methods

Apr 25, 2014

I will try to explain what i want to code , a HiLo game where the user can choose up to 3 different levels(1-10, 1-100, 1-1000) with these 3 methods

public static void main(String[] args) {...}
public static int playGame(int maxNumber) {...}
public static void giveResponse(int answer, int guess) {...}

with no Random , i will use the:

int number = (int)(Math.random() * max) +1; to generate numbers

I have tried so many times , but i don't get it ....

My code so far :

import java.util.Scanner;
public class HL{
public static void main(String[] args ){
Scanner s = new Scanner(System.in);

[Code] ....

View Replies View Related

Why Boxing Is Preferred Over Var-args

Oct 26, 2014

I know from JLS that widening is preferred over boxing and boxing is preferred over var-args.

I understand that, widening is legacy methodology and designers tend to keep it as a priority. What i fail to understand is why boxing is preferred over var-args. Here are my two concerns.

Why boxing is preferred over var-args?How behind the scenes boxing and var-args is interpreted? How are var-args interpreted by the compiler? Is some sort of Array formed behind the scenes?

View Replies View Related

Sorting Files In Folder By Last Modified Date

Mar 22, 2015

i have to save some particular info of a pdf file info into a database.there are lots of folders with tons of pdf files to be analized and then getting that info saved. make the process incremental? i need the program to stop at some point. and then continue to analize the resting files in the folders (i dont want the program to start all over again from 0 )my ideas are..sorting all the files using apache commons sort (by date) method (iv seen it somewhere) and saving the last file analized in the dabatase to then continue. OR just adding some extra character to the pdf file name that has been analized like for example xx-xxx.pdf to xx-xxxa.pdf.

View Replies View Related

Reading / Outputting A Text File With Modified Content

Feb 15, 2014

This is sort of like the last problem I had but it's all about the formatting at the end. I have a file that reads something like:

Name
a bunch of text here
and perhaps a second
or even a third line

I need to output this as:

Name; "a bunch of text here and perhaps a second or even a third line"

Right now I find 'Name' and it outputs:

Namea bunch of text here and perhaps a second or even a third line

How would I add ";" and quotes in the middle? I can imagine that I may need to find name, then skip to the next line and just add name manually as the variable output of the search string.

This is where I am now

public static void main(String[] args) {
boolean output=false;
String name="";
String junk="CHAMBERS";
TextIO.putln("Search for a name");
name = TextIO.getln();
TextIO.readFile("doc.txt");

[Code] .....

So I'm almost there, but those dange double Names are killing me. I tried to add a bit of code where:

if (line.indexOf(name) >= 0){}

View Replies View Related

File Directory Search Using Name / Extension / Content And Date Modified

May 21, 2014

I'm trying to make a search engine that will search my computer given a path with any options i decide. So if i decides to look for the file name "resume" with extension "pdf", it will give me the files in the directory, including subfiles.

import java.io.*;
import java.util.*;
import java.text.*;
public class mySearch
{
private final static int path = 0;
private final static int name = 1;

[Code] .....

View Replies View Related

Servlets :: Cash Counter - How To Send Response To A New Window

Mar 3, 2015

I am creating cash counter application. i want to generate a pdf receipt in new window and print it.

I am using jsp to take input from user and servlets to process the input.

I am able to generate a pdf but in same page. i want it to be a popup menu. How to implement it?

View Replies View Related

How To Choose The Right Collection

Feb 14, 2015

I have small project to be implemented in Java, which, expected the management of a parking.

The project has a class abstract Vehicle, whence derive three classes: Car, Motorcycle, Heavy Vehicles; the cost estimated time for the 3 types of vehicles are: 2€ for Cars, 1€ for Motorcycle and 5€ for H.V.

In addition, in class Ticket will be stored the arrival time of the customer and the characteristics of his vehicle.

Finally, in the class Parking(which provides 80 places available), here it should be added the various types of vehicles.

Now, I though of using an Collection, as Set.. So that they can not, two Vheicle with same license plate.

View Replies View Related

JSP :: Choose A Value From List Item?

Feb 11, 2015

I need to choose the value of a list item in jsp. There are many employees in various departments and i need to choose that employees in department wise.

Example. I have two list items in jsp

1. Select dept_no,dept_name from departments
2. SElect emp_name from employees, departments where emp_dept_no=curr_dept_no and curr_dept_no = dept_no

These two are the list items. When i choose the department from the first list item i need to display the employees in that particular department in the second list.

View Replies View Related

Servlets :: Which Framework To Choose

Aug 11, 2014

I have good knowledge of servlet,jsp. I've also worked on mvc pattern and now looking to learn a web framework but i'm not sure which to choose between spring mvc OR struts.Should i first do struts and then go for spring or can i choose spring directly?

View Replies View Related

Unable To Register Network Mounted Drive Path

May 17, 2013

I ma trying to implement Java "watchService". I am unable to register network mounted drive path. Is there any solution for this.

Path ftpFolder = Paths.get("H:/Ftp/Incoming/");

where H is mounted Drive.

View Replies View Related

JSP :: Choose / Display Image Path

Mar 15, 2014

I want to do the followings:

-When i press "choose the Image Path" a window open like a picture 2.
-I want also satisfy the condition written in red.

View Replies View Related

Guessing Game Always Choose Same Number

Jan 4, 2015

I am using eclipse for this project. Every time I run this program the choose method will always choose 0. Ignore the Sleep.sleep() method, there is another class in the program that performs it.

import java.util.Scanner;
public class gamestart {
public static int num;
public static String name;
public static String diff;
public static String choice;

[Code] ....

View Replies View Related

Recursive Program - Choose K Objects Out Of N

Apr 20, 2015

I recently wrote a simple recursive program that chooses K objects out of N (I was asked to use the variables N choose the R, however) total objects. Here is the code:

int n = 0;
int r = 0;
//the total number of objects defaults to 0
String nChoice = JOptionPane.showInputDialog(null, "How many objects are there to choose from?");
String rChoice = JOptionPane.showInputDialog(null, "How many object are to be chosen from this group?");
try {
n = Integer.parseInt(nChoice);

[Code] ....

It works fine, however in my class we were given two different formula to implement into our code. I used the one above, obviously. However, the second formula we were given was:

C(n,R) = n!
-------(R!(n-R)!)

I had to get the spacing right.

How do I read this formula? How could it be implemented? What are the benefits (if there are any) from using one method over the other? Which method of calculating N choose K (or, in my case, N choose R) would be more widely accepted?

View Replies View Related

Choose Option To Get Contact Details - Not Getting Output Expected

Feb 20, 2015

When I run my program and choose option 2 to get contact details I am expecting it to display as follows (First Name, Last Name): Contacts how have been entered:

0) John Doe
1) George Smith
2) Nancy Davis

Please enter the number corresponding to the contact you would like to view:

Instead for a personal contact it is displaying as follows:Contacts who have been entered:

0) Doe 1 F St. (last name, address)

Please enter the number corresponding to the contact you would like to view:

Instead for a business contact it is displaying as follows:Contacts who have been entered:

0) 1 F St. jd@gmail.com (address, email)

Please enter the number corresponding to the contact you would like to view:

Then when I enter the number to display the contact for personal it is returning me only first name and business is only returning me first and last name. It should be returning the full contact info that was put in during the add contact step. I thought I programmed everything properly but it isn't displaying what I want to seeMy code is listed below.

ContactList

/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package contactlist;
import java.util.ArrayList;
import java.util.Scanner;

[code]....

View Replies View Related

JavaFX 2.0 :: DateTimePicker - Option To Choose Date And Time?

Jun 6, 2014

JavaFX 8 has a DatePicker which is very nice. Does it have an option to chose a date and a time?

View Replies View Related

Writing A Program Using Switch Statement - Allow Users To Choose Item Of A Menu

Oct 5, 2014

Write a program using switch statement to allow users to choose an item of a menu. For example, the menu looks like the following.

File menu
1. Open
2. Close
3. Save
4. Exit
Enter your choice:

If you type 1, then your program should print out "Open is selected" (double quotes not included).

Notice:
(1) Using Scanner to get user choice;
(2) If the number user input is not in {1,2,3,4}, your program should let user know that.

Here's what I have:

public static void main (String[] args) {
int user = 1
switch (1) {
case value: 1
System.out.println ("Open is selected");

[Code] .....

View Replies View Related

Ash Register Class With Retail Item Class?

Apr 27, 2014

I have to make a cash register class that can be used with a RetailItem class that I did in another assignment. It should simulate the sale of an item. It should have a constructor that accepts a RetailItem object as an argument, and the constructor should also accept an integer that represents the quantity of the items being purchased.

I have no errors but here is the output I am getting:

How many candy bars are you buying? 5
Subtotal : $0.00
Sales tax : $0.06
Total : $0.06
BUILD SUCCESSFUL (total time: 3 seconds)

The code I have so far below:

CashRegister Class
package cashregisterdemo;
public class CashRegister {
private RetailItem retailItem;
private int quantityItems;
private final double SALES_TAX = .06;
private int Subtotal;
public CashRegister()

[code]...

View Replies View Related

Writing A While Loop To Read Positive Integers From User Until User Enters EOF Character

Feb 24, 2014

import java.util.Scanner;
public class Project_5
{
public static void main (String[] args)
{
Scanner input= new Scanner (System.in);

[code]....

So I'm attempting to have this program take the users input of integers, pressing enter in between each one. If they enter a negative number it lets them know that its invalid. At the end of the program it takes all of the valid integers entered and must add them and average them. I've put the final println in there as a placeholder. If the user types in "6" then presses enter and types in "3" , the output is:

There were 3 valid numbers entered.
The sum of the valid numbers was --- and the average was ---.
There were 0 invalid numbers entered.

It then continues on allowing the user to enter more values. Here is the example output for correct code"

Enter a positive value (EOF to quit): 4
Enter a positive value (EOF to quit): 7
Enter a positive value (EOF to quit): 8
Enter a positive value (EOF to quit): 2
Enter a positive value (EOF to quit): -1
The number "-1" is invalid.

Enter a positive value (EOF to quit): 8
Enter a positive value (EOF to quit): 0
Enter a positive value (EOF to quit): -4
The number "-4" is invalid.

Enter a positive value (EOF to quit): CTRL-D

There were 6 valid numbers entered.
The sum of the valid numbers was 29 and the average was 4.83.
There were 2 invalid numbers.

View Replies View Related

Java Program That Will Ask A User To Input Grades Until User Inputs Sentinel Value

Apr 9, 2014

Write a java program that will ask a user to input grades until the user inputs the sentinel value -1. The program should test each input to determine whether 0<=grade<=100. If the grade entered is within this range, the program should print "Grade accepted;" if not, the program should print "Invalid input".

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved