Calculate Total Sales After Each Football Game - JOptionPane (input / Output)
Mar 5, 2014
This specific assignment requires me to write a program that calculates the total sales after each football game. There are 4 types of tickets: box, sideline, premium, and general admission. After each game, data is stored in a file... then output the number of tickets sold and total sale amount. Format your output with 2 decimal places.
Okay I know there is a I/O section and wasnt sure where to post this. I need some insight on how to use file input and output as well ... Here is my program:
import javax.swing.JOptionPane;
import java.text.DecimalFormat;
public class ticketsSold
{
public static void main(String[] args)
{
String BoxSeat;
String SideLine;
[Code] ....
View Replies
ADVERTISEMENT
Oct 19, 2014
I'm trying to write a sales tax program with JOptionpane but I received this message: illegal start of expression
import javax.swing.JOptionPane;
public class SalesTax {
public static void main(String[] args) {
String amount;
double stateSalesTax;
double countySalesTax;
double totalSalesTax;
double totalSaleAmount;
double amt;
JOptionPane.showInput.Dialog("Enter the amount of purchase");
[code]....
View Replies
View Related
Oct 11, 2014
I'm struggling with inheritance in my assignment. The assignment states that I should use the calculatePrice() to calculate the total price and use another method to display the total. The I must overload the calculatePrice() and add a fee in the SpeedOrder() class.
My main class
package useorder;
import javax.swing.*;
public class UseOrder {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Order.display();
[Code] .....
The problem is mainly displaying the TotalPrice field and. I can't display TotalPrice if it's not static but if it's static I can't inherit it to the SpeedOrder class to assign the total in the overloaded calculateprice method. How can I display the total in my order class and use it in my SpeedOrder class?
View Replies
View Related
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
Mar 28, 2014
I cannot get the right output for my program. I need to get the total number of pennies in dollar amount for the output of Total Pay. This is my program. The directions are:
Write a program that calculates the amount a person would earn over a period of time if his or her salary is one penny the first day, two pennies the second day, and continues to double each day. The program should then show the total pay at the end of the period. The output should be displayed in a dollar amount, not the number of pennies. Do not accept a number less than 1 for the number of days worked.
import java.util.Scanner;
import java.text.DecimalFormat;
public class PenniesForPay {
public static void main(String[] args) {
int numDays;
[Code] ....
totalSalary should be total number of pennies / 100....However its not picking up only day 30 of pennies which is 536,870,912 pennies and then dividing it?
View Replies
View Related
May 22, 2014
JOptionPane.showMessageDialog(null,myRoster.totalGoalsScored + " is the total number of goals scored by all the players on the roster");
HOW CAN I CALL THE METHOD totalGoalsScored and display it using JOptionPane
ERROR: CAN NOT FIND SYMBOL
View Replies
View Related
Oct 9, 2014
i have to ask user gross sales until -1 sentinial and to get the commission to put in groups its 9% times the sales add $200
the groups are formatted
a) $200-299
/> $300-399
....
i) $1000 and over
import java.util.Scanner;
public class Commissions {
/**
* @param args
[Code]....
View Replies
View Related
Jun 29, 2014
Design a program that will read a file of sales records and produce a sales report. Each record in the file contains a customer's ID, name, a sales amount, and a validated GST code. The GST code is to be applied to the sales amount to determine the sales tax due for that sale, as shown below.
GST CodeGST Rate
0
1
20%
5%
10%
The report is to print a heading "SALES REPORT", and detail lines listing the customer's ID, name, sales amount, sales tax, and total amount due including sales tax.
Is assignment
sofar:pseudo code
SalesReport
Read customer file
Get TaxCode
Get GSTAmount SalesTax
Calculate SalesTax
[Code] ....
View Replies
View Related
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
Feb 25, 2014
I understand the basics of using the JOptionPane Message boxes, but how do i take the information that is entered and store it as a file, or print it. I'm in my 6th week of class, and this happens to be maintenance related.
import javax.swing.JOptionPane;
public class Example_Maintenance_System{
public static void main (String [] args) {
//Operator Name Input
String operator_name;
operator_name = JOptionPane.showInputDialog("Please scan your barcode");
[code]....
View Replies
View Related
Feb 9, 2015
I was wondering how can I calculate total age in months and store it as variable? this is what I have so far:
*
* You will ask the user to provide their name (as a single word, assume first name here)
* You will ask the user their age in full years (no fraction or months)
* You will ask the user how many full months since their last birthday (again, whole numbers here).
*
* You will use this information to calculate the user's age in months and use that information to print out a greeting.
*/
import java.util.Scanner;
[code].....
View Replies
View Related
Apr 10, 2015
How to calculate the qty and price and total of the amount in total column.
View Replies
View Related
Sep 21, 2014
I am making a shopping cart web, but some problems I meet about how to calculate the total price
I use ajax in product list web and if I choose one product , it will send the Id that I read from MySql to servlet and use session to save it . and I click the button jump to the cart, the page cart.jsp will read information from session ,and find product information from mysql by id , now my question is where I calculate the total price, servlet or jsp?
View Replies
View Related
Nov 10, 2014
So basically, I've been trying to create a for loop that asks the user for a number between 1 and 30, then calculates the total of the series of numbers. For example, if 15 is entered, the calculation should be 1/15+2/14+3/13+...15/1 which would equal approximately 38.1. The problem I'm having is that the code doesn't loop whenever I type a number for some reason, which results in a very incorrect calculation. Here is my code so far:
import java.util.Scanner;
public class HmwLoop {
public static void main(String[] args) {
double sum = 0;
for (double num1 = 1, num2 = 30; num1 <= 30 && num2 >= 1; num1++, num2--)
[Code] .....
View Replies
View Related
Sep 12, 2014
The pay rate is php 35.00 per hour. any hours worked after 40 hours is paid at rate of 2 times the normal hourly rate. Calculate and display the Normal Pay, The overtime pay, and the total pay.
OUTPUT MUST BE:
Sample 1 :
Enter Hours Worked: 40 (Sample)
Normal Pay: 1400 (Sample)
Overtime Pay: 0 (Sample)
Total Pay: 1400 (Sample)
Sample 2 :
Enter Hours Worked: 41 (Sample)
Normal Pay: 1400 (Sample)
Overtime Pay: 70 (Sample)
Total Pay: 1470 (Sample)
Here is my code or something, but i cant finish it.
import java.util.Scanner;
public class Workpay {
public static void main(String[]args) {
Scanner in = new Scanner (System.in);
int hours;
int normalpay = 35;
[Code] .....
View Replies
View Related
Jun 12, 2014
table.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
public void valueChanged(ListSelectionEvent e) {
System.out.println("Value changed");
if(Float.parseFloat(table.getModel().getValueAt(table.getSelectedRow(), 4).toString()) != 0.0){
System.out.println(getTotal());
totalAmount.setText(""+getTotal());
}
}
});
This is what I've tried so far. What i want to do is to calculate all Total Amounts by adding all the rows (5th column only),as 5th column has total amount for 1 product, and set the text for a JTextField whenever the 5th column of any row changes its value.But this isn't working my way. I have also tried keyListener to trigger that change at Enter key typed but that also don't work for me.
View Replies
View Related
Feb 28, 2014
You have a store that sells the following items:
Shoes $50.00
T-shirts $30.00
Shorts $75.00
Caps $15.00
Jackets $100.00
Your sales associates need a program where they can enter customer information and calculate the customer's total bill. When the sales associate enters the program they should be presented with this main menu.
Enter customer information
Display Total Bill
Quit
If the sales associate selects option 1, the program should allow the sales associate to input their name, address, and e-mail address. Your program should then display this customer information to the screen with a message that the customer has been added to the customer list.
If the sales associate selects option 2, the program should ask the sales associate for the customer's name, product that the customer is purchasing, the quantity, and the price of the product. The total bill will then be displayed to the screen and should include the following:
- The customer's name.
- The product the customer is purchasing, the quantity, and total cost
- The amount of tax 8%
- The total cost with tax.
Example Total Bill Output:
John Doe
Product Purchased Quantity Total Cost
Shoes 2 $100.00
Tax 8%: $8.00
Total Cost: $108.00
HOW DO I WIITE IT
View Replies
View Related
Oct 5, 2014
So I've attempted a for loop for this type of problem:If you receive $0.01 on the first day of your allowance, and the daily rate doubles each day after, calculate the total earnings for 30 days.
Output should be like:
Day ----- Daily allowance - Total allowance
1 -------- 0.01 -------------- 0.01
2 -------- 0.02 -------------- 0.03
3 -------- 0.04 -------------- 0.07
My code so far:
public class Allowance
{
public static void main (String[] args)
{
int day = 0;
double daily = 0.0;
double total = 0.1;
System.out.println("Day Daily Allowance Total Allowance");
for(day = 0; day <= 30; )
[code].....
View Replies
View Related
Apr 13, 2015
I have an assignment to create a JFrame pizzaorder and at the end of this order after the totalprice is calculated I need to format the number to ##.## but I keep getting a cannot find symbol error.
Source Code:
import java.awt.*;
import javax.swing.*;
import javax.swing.event.*;
import java.awt.event.*;
public class pizzaorder extends JFrame implements ItemListener, ListSelectionListener
//top section will have centered title telling the name, and under it seperate instructions to choose your pizza and toppings
[Code] ....
View Replies
View Related
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
Mar 24, 2014
So I have a class called Team that is a collection of players and managers for a baseball team, and one of my required methods is to calculate the total amount of Home Runs hit by the batters. Now along with the Team class I have an abstract Employee class, an abstract Player class and a Batter class that extends the Player class I thought this would be fairly easy but it is coming out to be pretty hard my code is as follow:
class Team {
public int _numPitcher;
public int _numBatter;
public String _manager;
public ArrayList<Player> team;
[Code] ....
The total salary works awesome but for some reason when I try and call up how many home runs a player has it wont call correctly I get this red line under my code that says: The method getHomeRuns() is undefined for type Player. I am trying to call this from the batter class which is an extension of the Player class...
View Replies
View Related
May 12, 2014
I'm trying to create a GUI application that calculates and displays the total cost for certain automotive maintenance services. The application should contain hree classes: 1) the main class that creates and displays the window; 2) a panel for the routine services and 3) a panel for the non-routine services. 2 and 3 are instantiated in 1. I'm pretty positive the error lies in the NonRoutinePanel class because when I comment it out of the main class the program runs fine. But I can't quite figure out which lines of code or methods are causing the problem.
When I try running the program I get these error messages:
Exception in thread "main" java.lang.NullPointerException
at java.awt.Container.addImpl(Container.java:1040)
at java.awt.Container.add(Container.java:958)
at javax.swing.JFrame.addImpl(JFrame.java:540)
at java.awt.Container.add(Container.java:926)
at JoesAutomotiveGUI.<init>(JoesAutomotiveGUI.java:38)
at JoesAutomotiveGUI.main(JoesAutomotiveGUI.java:111)
Here's my code for the three classes:
import javax.swing.*; // Needed for Swing class
import java.awt.*; // Needed for BorderLayout class
public class RoutineMaintenancePanel extends JPanel
{
public final double oilChange = 26.00;// cost of oil change
public final double lubeJob = 18.00;// cost of lube job
[Code] .....
View Replies
View Related
May 6, 2014
How can I do the work below in Java
In this main class, create 5 objects of the class Menu, as defined in the table below.
Name amount of calories cooking time price per person number of drinks
Fufu and Groundnut Soup 564.65 2515.572
Red Red 345 12 9.980
Rice and Beef Stew 560.4 1512.651
Ga Kenkey and Fish 780 10 10.15 1
Banku and Tilapia 450.4 35 25.17 2
Exercise d
In your main class create an array of length 5, and store the 5 objects (Exercise c) into the array. You can use any name for your array.
From the array, use a loop to: Print the details of all the objects using the method you defined in Exercise b.
Exercise e
Use another loop to:
-Print only the name and cooking time of all the dishes that take less than 30 minutes to cook. Hint: you may use the getter methods for the name and cooking time attributes, and then, print these values (name, cooking time).
Exercise f
Use another loop to :
-Calculate and print the total price of all the objects (in the array).
-Calculate the total price of all the objects with VAT included for each dish (VAT rate is 17.5%).
Submission
-Create a folder with your index number as its name.
-Copy your Java Project folder into the created folder.
-Print a hard copy of your classes.
-Submit both soft copy and hard copy of your project
View Replies
View Related
Jan 23, 2015
I am currently truing to make this class instantiate 100,000 dice rolls of 2 dice. And I also need to keep track of how many times each possible total occurs and I am having trouble outputting the result. Right now when I run my code it is just showing the results of each of the 100,000 roles.
public class ltefera_DiceRollTest {
public static void main(String[] args) {
ltefera_DiceRoll diceRoll = new ltefera_DiceRoll(10);
System.out.println("Total # of pips" + "
");
diceRoll.printArray();
System.out.println(diceRoll.countDice(2));
System.out.println(diceRoll.isArrayDataValid());
System.out.println(diceRoll.getTotal());
System.out.println(diceRoll.allDifferent());
[code]....
"how many time each possible total occurs"
View Replies
View Related
Feb 9, 2014
It works to the point that the user inputs "c" "s" or "r" then it does nothing else ? I can get it to run in my terminal window but when I try to get the JoptionPane windows to work it freezes up.
import java.util.*; // For Scanner
import java.lang.String.*; // For toUpperCase()
import javax.swing.JOptionPane; // for cute lil java windows
public class CaculateAreaOpt {
// Declare all variables needed for program
public static Scanner in = new Scanner(System.in);
public final static double radius = 3.14;
[code]....
View Replies
View Related
Apr 4, 2015
public class CarV5
{
// private instance variables
String Model1;
int endMiles1, startMiles1;
double gallonsUsed1, pricePerGallon1;
[Code] .....
When I try to compile the program, its telling me that it cannot find the Dist variable in the main method for calcMPG and calcGPM. I'm not sure if the methods are right for the calcGPM or calcMPG.
View Replies
View Related