How To Display Amount Paid By User And Show Balance

May 3, 2015

I've four classes object. I don't know how to display the amount paid by the user, and show the balance. The calculate button just show the total amount. Do I have to create another object class? And I've to show the bills too.

This is my 1st Frame

import javax.swing.*;
import java.awt.*;
//titlepanel class displays a title in a panel
public class TitlePanel extends JPanel {
public TitlePanel() {
JLabel title = new JLabel();

[Code] .....

View Replies


ADVERTISEMENT

Calculate Total Amount Paid And Display It - NULL Error

Dec 10, 2014

Exception in thread "main" java.lang.NullPointerException
at ShoeStore.calculateTotal(ShoeStore.java:103)
at ShoeStore.main(ShoeStore.java:88)

This is the error when program is ran. The program is supposed to calculate the total amount paid for all shoes and display it.

import java.util.Scanner;
 public class ShoeStore
{
public static void main(String[] args) {
Scanner keyboard = new Scanner(System.in);
String shoe_Name, nameStore, type;
int size, shoeAmount;
double sellingCost;
 
 [Code] .....

View Replies View Related

Show Balance In Simple ATM

Nov 25, 2014

This code models a simple ATM machine that can deposit, withdraw, and show the 10 latest transactions in an array of 10 index values.

My problem is that I can't get the balance right after 10 deposits, the balance only seems to sum the values in my array, not including the transactions made before those ten.

import java.util.Scanner;
public class cashier2 {
public static void main(String[] args) {
Scanner keyboard = new Scanner(System.in);
int amount = 0;

[Code] ....

View Replies View Related

Show Amount Of Number According To Its Interval

Jul 4, 2014

I am trying to make a program that get input value 1-200 from user. However I would like to make the program to show warning if the input number is not within the range of 1-200. In the end I would like to show the amount of number according to its interval (i.e less 50, 51-100 and so on) ....

import java.util.Scanner;
class test {
public static void main (String[] args) {
int number[]= new int[5];
int number2[]= new int[5];
int a=0,b=0,c=0,d=0,i=0;

[Code] .....

View Replies View Related

Show Up Amount For Multiple Photo Books

Oct 9, 2014

import java.util.Scanner;
public class LM6Assignment
{
public static void main(String[] args)
{
Scanner inputDevice = new Scanner(System.in);
int numBooks = 0;
double onePhotoBook = 10.99;//each book cost 10.99
double costof1Book;
//mehtod calls
costof1Book = computeBill(onePhotoBook);

[Code] ....

How to code it so I can put in how many books they need and for it to show up with the amount for multiple photo books..

View Replies View Related

JSP :: How To Display Amount In Indian Format

Apr 30, 2014

i want to display a amount in indian currency format,

i.e=10000000=this iwant show is=1,00,00,000 rather than 10,000,000

View Replies View Related

Program To Determine Max Amount Of Units Sold And Display It In Dialog Box

Feb 9, 2014

I am trying to write a program that basically determines the max amount of units sold and displays it in a dialog box. Also, the program will display the winning sales associate out of 10. I have wrote the program successfully so far and I can see the maximum number of units sold displayed in the dialog box, but I cannot seem to link the winning sales person.

Here is the code I have typed so far.

//Program to find maximum of three number

import javax.swing.JOptionPane;
import java.util.Scanner;
public class Sales
{
public static void main (String[] args)
{
//Declare variables
int num1, num2, num3, num4, num5, num6, num7, num8, num9, num10;
int large;
int winner;

[Code] ......

View Replies View Related

Basic GUI Calculator - Display Amount Of Commission And Total Annual Salary In Dollar Format

Apr 28, 2014

So, I am supposed to write a program that calculates the total annual compensation for a salesman using user input for the salary, sales, and commission rate (list of 3 predefined commission rates. have to display in dollar format the amount of commission and total annual salary.

CommCalc class

public class CommCalc
{
//attributes of class, stored data
private double sales;
private double salary;
private double rate;
//and a total field? beware stale data.
//store sales argument from sales field
public void setSales(double sal)

[Code] ....

I know that i have to fix some of the semantics . I have this code that I made earlier, is there an easy way to make it into a GUI interface? Or will I have to go throughthe code lines to add the JOptionPane? And I am a little confused on how to make a list (array) for the commission rate.

View Replies View Related

Program That Prompts The User To Enter Loan Amount And Years

Oct 21, 2014

so I had to make a program that prompts the user to enter a loan amount and the years for the loan and I have the conversions and everything my only issue is that when the chart pops up it just looks like a bunch of numbers and its missing the column headers

for example

Interest Rate Monthly Payment Total Payment

import java.util.Scanner; 
public class InterestRate { 
public static void main(String[] args) { 
double monthlypayment = 0; 
double totalpayment = 0; 
Scanner input = new Scanner(System.in);
System.out.println("Enter Loan Amount");

[Code]...

View Replies View Related

User Should Be Able To Enter Amount Of Digits Array Should Be Shifted Left

Nov 6, 2014

This is the other code problem I have. The user should be able to enter the amount of digits the array should be shifted left. For example, if the user entered 3 and the array was 1 2 3 4 then it should return 4 1 2 3. here is my code.

public char[] replaced(char[] array, char oldChar, char newChar) {
char myFun[] = new char[array.length];
for (int i = 0; array.length > i; i++) {
myFun[i] = array[i];

[code]....

View Replies View Related

Amount Of Spell User Uses - How To Increment Initial Randomized Output

Feb 16, 2015

I created my own class and it basically randomizes the amount of 'spells' [magic] a user uses (range 1-5). I can't figure out how to increment the initial randomized output to make something like this :

User X : uses 2 spell.
User Y : uses 3 spells.

User X : uses 3 spells. (Taking the randomized 2 and increment by 1)
User Y : uses 4 spells. (Taking the randomized 3 and increment by 1)

My current setup looks like this : First one is the class I created and the second one is just how the output would look like. (seperate by +++++...)

My goal is to create a METHOD to increment it.

public class Spell {
// Max number of spells
private final int MAX_FACE_VALUE = 5;
// Current face value
private int faceValue;
// New instance of Spell
public Spell() {
faceValue = 1;

[Code] ....

+++++++++++++++++++++++++++++++++

public class SpellOutput {
public static void main(String[] args) {
//Object creation
Spell spellCasterOne = new Spell();
Spell spellCasterTwo = new Spell();
Spell spellCasterThree = new Spell();

[code] ....

View Replies View Related

Vending Machine - Tell User Combination Of Coins That Equals To Amount Of Change

Jan 25, 2012

I have a simple java program to write which tells the user combination of coins that equals to the amount of change i.e:

user input 87

output:

3 quarters
1 dime
0 nickels
2 pennies

How the program remembers the remainder which is passed to the next column of let say dime

i.e

originalAmount = amount;
quarters = amount /25;
amount = amount % 25; <---- this is confusing for me?!?! how can the integer = integer % 25
dimes = amount / 10; <--- HOW THE PROGRAM remembers the "remainder" instead of the original user input as the code it self tells you dimes = amount where "amount" is what user input NOT remainder.

amount = amount % 10;
so on ....;

What I don't understand is HOW this algorithm works. I mean we have int amount where user inputs the number we get the first calculation amount/25 = how many quarters and then amount %25 WILL tell us about the reminder. By looking at this piece of code I would say that the system should start the calculation for the dimes again from the original number since the code says dimes = amount/10 AND amount = amount%10. My understanding is that the calculation should be done from the original user input.

Book or code it self is not clear for me how the reminder is "REMEMBERED" and then pass on to the next calculation>!?!?

UNLESS the code: amount=amount%25 gets the remainder so the next code under it is REQUIRED to read from the last prompt code.

View Replies View Related

Enter In Sales Amount And Then Get It To Display Asterisk Per 100 In Sales

Apr 3, 2014

{
public static void main (String []args)
{
Scanner numberin = new Scanner (System.in);
double store [];

[Code]....

How would I get my program to display a * for every 100 dollars in sales that the user enters in so: for example the user enters in store 1: $ 400 in sales for the store I want it to display store 1:****

The first part of my code allows the user to enter in whatever values the stores have in sales. The Second half of the code starts at line 19 is my best guess on what I need to do I just am not sure how to get it to display what I need it to.

View Replies View Related

Servlets :: Shopping Cart - Show Text Based On Which Page A User Is Coming From

May 30, 2014

I am making a shopping cart app in JSP and servlets to bring it all together. Finally.

I have a registration servlet (c1), a registration form jsp (c2), a login jsp (c3). c1 checks if a username is in the database or not.

If the username is not there, then register the user and send them to c3. I want c3 to display a "registration successful" message if a user has just registered successfully and is coming from c1. ELSE, take the user back to c2 with a message which tells them to choose a different username or password etc.

How do I implement the logic of showing a message depending on where a user is coming from ? The servlets and jsps are ready and I only need to add this logic for a custom message. Of course, I could make a JSP for Registration Successful and one for Registration Failure. But, that seems to be unnecessary.

View Replies View Related

JavaFX 2.0 :: Adding Tooltip On Cell Of TableView In Order To Show Some Information To User

May 21, 2014

I'm trying to add a tooltip on a cell of a TableView in order to show some information to the user.
 
This is the code:

colonnaColore.setCellFactory(param -> {
            TableCell<Appuntamento, Template> cell = new TableCell<Appuntamento, Template>() {
                @Override
                protected void updateItem(Template item, boolean empty) {
                    // calling super here is very important - don't

[Code] ....
 
In few words: there is a cell factory on the cell to show a colored box, then I added a tooltip to the cell. I need informations that are in the item added to the TableView that has type "Appuntamento". So I try to get my element with these code (that in others part of my code works); but here I get a Null Pointer Exception on cell.getTableView() and also on cell.getTableRow().
 
I'm probably using these methods in a way that was not expected.

View Replies View Related

Payroll System For Hourly / Fixed Monthly And Commission Paid Workers Of Company

Dec 21, 2014

I am doing a program where i have to implement a payroll system into a company for hourly, fixed monthly and commission paid workers. I also have to put the method which i did. the problem is I cant tell if my calculation is wrong or if i am missing a codes some where. The output is not giving me the answer that I was at least expected,

Here is my method:

{
< double total_deduction;>
< total_deduction = gross_pay - deduction;>
< return total_deduction;>
}
< public static double calGrossH(double hours_worked, double pay_rate)>

[Code] .....

I have done a lot researching and have come up with some search with almost the same calculation and I have also asked employees of a company on how they calculated hourly rate, commissions rate and fixed rate for all workers and gotten the same response but for some reason the output is not what it is supposed to output. here is my output.

<
un:>
<please enter the number of employees to be processed 31>
<please enter employee id number 3669>
<please enter employee first name>

[Code] ....

I dont know if I am missing some calculation somewhere or codes been researching and bussing my brains to figure out where is the missing codes or calculation.

View Replies View Related

How To Sort A List By Balance

Mar 26, 2014

Add accounts on a list, each account contain: name, accountCode, pinCode, balance.

How to show list sort by balance?

View Replies View Related

For Loop Declining Balance

Apr 10, 2015

This is my current code:

import java.util.*;
public class Testing
{
public static void main(String[] args)
{
Scanner keyboard = new Scanner(System.in);
int loanAmount, loanDurationYears, periods;
double interestRate, monthlyPayment, totalInterest, balance;
 
[Code] .....

Output:

Enter loan amount:90000
Enter loan duration in years:15
Enter interest rate as a percent:6.75
Loan amount: $90000
Loan duration: 15 years

[Code] ....

How the output should look:

Enter loan amount: 90000
Enter loan duration in years: 15
Enter interest rate as a percent: 6.75
 
** RESULTS **
 
For a 15 year loan of $90000.00 at 6.75% interest --
 
Monthly payment = $796.42
Total interest =$53355.33
 
Yearly balances
 
YearInterestLoan Balance
15965.23 86408.21
25715.14 82566.33
35447.64 78456.94
45161.51 74061.43
54855.46 69359.87

[Code] ....

There seems to be a lot of things wrong with the output I get, but I'm not sure why. How do I get the output to print in columns? Also, how do I get the numbers to round?

View Replies View Related

Account Balance Does Not Change

Apr 13, 2014

I need to make a program that uses an object to calculate balance

import java.util.Date;
public class Account {
/** Setup Default Variables */
private int id = 0;
private double balance = 0;
private double annualInterestRate = 0;

[Code] ....

View Replies View Related

Bank Account - Balance Must Be A Floating Point Number

Sep 21, 2014

Develop the class “Account” to be used by a bank. The Account class should have a single instance variable “balance”. Remember that balance must be a floating point number. The required methods for the Account class are shown below.

The Account class “debit” method should return a Boolean and should not allow an overdraft. If a withdraw greater than the current balance is attempted, the function should immediately return “false” and do nothing else.

Develop a test class to thoroughly test all aspects of the Account class. DO NOT change the class name or instance variable name given or the required method names as detailed below.

Account
1 constructor with no parameters (default balance to 0)
1 constructor with a balance parameter
setBalance method
getBalance method
credit method
debit method

I have the test class done, I won't need to put that in till later. My main problem is I'm not sure how I'm going to be able to get debit and setBalance to work together with each other.

public class Account
{
protected double balance;
// Constructor to initialize balance
public Account( double amount ) {
balance = amount;

[Code] ....

You can see I'm stressed out by not reading over my code. I already have the "Debit" in use, just have to change it. Which I did.

View Replies View Related

Recursion Program - Display Sum Function To User

May 1, 2014

This is a simple recursion program I had to write. I just cant seem to display my sum function to the user

import java.util.*;
import java.io.*;
public class Recursion {
public static void main(String[] args) {
int number = 0;

[Code] .....

View Replies View Related

New Lines Don't Show Up In File But They Do Show Up On Console

Apr 30, 2015

I have the following code.

class A {
List<StringBuilder> list;
public void output(List<StringBuilder> objectToOutput){
try(BufferedWriter bw = new BufferedWriter(new FileWriter("temp.txt"))){
for(StringBuilder row:objectToOutput) bw.write(row.toString());
}catch(IOException e){}

[code]....

Why don't the a's show up on the console? I put them in as part of the debugging process and now I don't understand why they don't show up in both places.

View Replies View Related

JOptionPane And StringBuilder - Display And Receive Information To / From The User

Mar 6, 2014

I'm using the JOptionPane to display and receive information to/from the user. In addition to this, I am using StringBuilder to receive inputs from the user and then manipulate (append) that input to display the desired output.

//Example

(JOptionPane): "Enter text"
(user input): Java is cool!
(program): *stringBuilder.append(" I love it!")
JOptionPane.showMessageDialog( );
.....

Psuedo-like code. The problem is that showMessageDialog(null, string) and not showMessageDialog(string, string). I want to display the enter text: " Java is cool! I love it! " in the JOptionPane. How do I accomplish this, since showMessageDialog only accepts (null, string).

View Replies View Related

Applet Java GUI Building To Display Words To User

Nov 17, 2014

Implement an applet that display historical facts. The applet will include facts from october 28 to december 4th to test the applet.

What is the best thing to add text in my GUI - JLabel, JTextArea? I am trying to display different words on my csFacts. Once a user click button yesterday and button tomorrow?

public class Facts extends JFrame implements ActionListener{
private JButton button1,button2;
private JPanel panel;
private JLabel label;
TextField ri = new TextField(50);
private void createGUI(){
setDefaultCloseOperation(EXIT_ON_CLOSE);

[Code] .....

View Replies View Related

Take User Input And Display Sum Of Digits Of Entered Number

Nov 6, 2014

I have returned with yet another problem but I think this one might be a bit easier to fix.

So the whole MO of this program is to take user input, and display the sum of the digits of the number they entered. I am supposed to do this by utilizing methods. So far this is what I have and when I compile it tells me that it "cannot find symbol", which I don't understand as I define what "m" is in the for loop. The other error is that it says:

"Exercise6_2.java:22: error: incompatible types: possible lossy conversion from long to int
return result;
^

I don't understand why it's giving me this error nor do I understand why result seems to inherently be an int. (Also the public static int sumDigits(long n) method was given to me by the book so that is what I am supposed to use).

import java.util.Scanner;
public class Exercise6_2 {
public static void main(String[] args) { 
Scanner input = new Scanner(System.in);
System.out.println("Enter a integer");
long n = input.nextLong();

[Code]...

View Replies View Related

GUI To Display Search Results Based On User Input Server Name

Jul 18, 2014

I am using a GUI to display search results based on user's input server name. I am using MS Access as DB and I have the DSN set up correctly.But the search results are displayed for the first typed value in text filed. I am getting same result set every time though i input different server names .

import java.sql.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.table.DefaultTableModel;
public class SearchResult implements ActionListener{

[Code]...

View Replies View Related







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