Sales Tax Increase At 6% Not Working
Feb 8, 2015
import java.util.Scanner;
public class SalesTax {
public static void main(String [] args) {
Scanner input = new Scanner(System.in);
double total = 0;
double currentTax = 0;
[Code] .....
View Replies
ADVERTISEMENT
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
Dec 25, 2014
I want to make a simple game and learn java by experimenting with it.I don't know how to increase a value by clicking it.I know how to make my objects move in my small game with mouse or keys, but I also got a score var that I want to increase per click. I can increase it over time, but after 2 hours of trying I couldn't progress any further.This is the piece of code I used, I imported the class, got getters n setters and all of that...
if(e.getButton() == MouseEvent.BUTTON3) hud.setScore(hud.getScore() + 555);
Whenever I click I get an error, if I remember right "NullPointerException" is when something is missing I'm probably not targeting the value correctly...
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at com.tutorial.main.MouseListens.mouseClicked(MouseListens.java:22)
at java.awt.Component.processMouseEvent(Unknown Source)
[code]...
View Replies
View Related
Nov 7, 2014
my project is to design a class that stores the number of units sold and has a method that returns the total cost of the purchase..the given info is unit are $99. discounts are 20% for 10-19 units; 30% for 20-49 units; 40% for 50-99 units; and 50% for 100 or more units purchased... When i run the code and put in the units sold it returns: 0 units sold, $0.00 cost, 0% discount. How do I get the output to actually do the equation and give proper information. We were given a demo file from the instructor and had to create a class that works with it first set of code is the demo file:
package chapter4;
import java.text.DecimalFormat;
import java.util.Scanner;
/**
* SoftwareSalesDemo Program
*/
public class SoftwareSalesDemo {
public static void main(String[] args) {
int units; // To hold units sold
[code]....
View Replies
View Related
Aug 7, 2014
I have this small program that creates a sales opportunity and its related products, and then prints out the opportunity name, total quantity and total price
class Opportunity{
String name;
int Amount;
String Stage;
int Product_quantity;
[Code] .....
The code works as expected, and is successfully prints :
Opportunity Name: Sales
Opportunity Amount: 110
Opportunity Product Quantity: 3
That said, I feel the way the OpportunityCreator class sums up the quantities and prices (see the comments on the code) is very inefficient, and would only work if there were 3 or less products. How can I design this so that it sums the quantities and prices of all the Product objects that I create, regardless of how many of them are? I understand probably I'd need to redesign the whole thing but I'd like to get at least an idea of how this can be achieved.
Originally I was thinking of creating an ArrayList and adding all the prices/quantities there but wasn't sure how to do. I also thought of using a loop to loop through the different object references and sum the quantity/price but was also unsure on how to do so?
View Replies
View Related
May 15, 2015
I was wondering what the easiest way would be to keep track of everytime someone makes a new post on reddit (social media site, for those who don't know). I want the program to keep track of the number of posts made with a counter, but that's the easy part. How do I set up a program to actually communicate with and monitor reddit's servers in this manner?
View Replies
View Related
Oct 7, 2014
Basically I need to increase the hours of an employee at the given index. Index is the position of the employee in the array, and amount is how many hours you will be increasing by.
This is what I have so far,
public void increaseHours(int index, double amount){
for(Employee e: employees){
if(e instanceof HourlyEmployee){
HourlyEmployee he = (HourlyEmployee)e
he.increaseHours(amount);
}
}
}
}
I'm not sure how to use the index to do this correctly, all it's doing right now is adding hours to every hourly employee
View Replies
View Related
Oct 7, 2014
Basically I need to increase the hours of an employee at the given index.Index is the position of the employee in the array, and amount is how many hours you will be increasing by.
This is what I have so far,
public void increaseHours(int index, double amount){
for(Employee e: employees){
if(e instanceof HourlyEmployee){
HourlyEmployee he = (HourlyEmployee)e
he.increaseHours(amount);
}
}
}
}
View Replies
View Related
Feb 12, 2015
I am working on trying to show the average daily sales for the store. I cannot quite figure out why my calculation is not working. Everything works except my average sales is always $0.00... lines 185-189 is where my calculation is located.
Java Code:
import java.util.*;
import java.text.*;
import javax.swing.JOptionPane;
/*******************************************************************************
* Create a fancy class for a cash register.
*******************************************************************************/
public class fancyRegister{
/** current amount due */
private double currentAmount;
[Code] ....
View Replies
View Related
May 19, 2015
While loading very huge xml file i m getting heap space error in myeclipse. So I wanted how to increase memory so that xml file will get loaded?
View Replies
View Related
Sep 29, 2014
When I try to write the .xlsx file using apache POI, XSSFWorkbook API and run this program in Eclipse STS, I am getting the java.lang.OutOfMemoryError: Java heap space error. Then I searched the net and add these -Xms512m -Xmx1024m in the eclipse VM arguments. Even though I am getting the same error. Again i increase heap size but i am getting the different error like "occurred during initialization of VM, Could not reserve enough space for object heap". how to increase the heap size or any other API to read, delete and write the .xlsx file. I am having 4GB ram in my machine. Apache POI is very good for .xls but if it is .xlsx performance wise it is very slow.
View Replies
View Related
Dec 3, 2014
I'm working on a program to create a blackjack game using objects (one for card, deck. and hand). Withing my hand object I am trying to add cards to the hand but it is only adding the last card i try to add and giving null values for the the ones before.
class BlackJackHand {
private BlackJackCard [] hand;
public void addToHand(BlackJackCard c) {
if (hand == null) {
BlackJackCard [] tempHand = new BlackJackCard[1];
tempHand[0] = c;
hand = tempHand;
[Code] ....
What I want this section to do is add cards to the current hand. I was intending for it the hand to be null at first and the if(hand == null) piece to add the card the first time and then the else piece would be used when the hand already has at leas one card. I want the else section to create a temporary array that is one larger than my current hand, copy the cards from the old hand to the new hand, and then add a new card to the last space before rewriting the old hand as what the temporary hand is.
The code I am using to test if the addToHand() is working is
class BlackJackTest
{
public static void main (String[]args) {
BlackJackCard c1= new BlackJackCard(1,0);
BlackJackCard c2= new BlackJackCard(1,4);
BlackJackCard c3= new BlackJackCard(1,5);
BlackJackHand h1 = new BlackJackHand();
[Code] .....
BlackJackCard has the parameters (int suit, int value)
This should print:
ace of clubs
4 of clubs
5 of clubs
but instead prints:
null
null
5 of clubs
View Replies
View Related
Sep 13, 2014
The manager of a football stadium wants you to write a program that calculates the total ticket sales after each game. There are four types of tickets: box, sideline, premium, and general admission. After each game, the data is stored in a file in the following format:
ticketPrice numberOfTicketsSold
Sample data might look like:
250 5750
100 28000
50 35750
25 18750
The first line indicates that the box ticket price is $250 and that 5750 tickets were sold at that price.
Your program should input in this data (using Scanner or an input dialog box), then output that data to a message dialog box along with total ticket sales information. Output the total number of tickets sold and the total sale amount. Make your output user-friendly and "pretty". Format your output with two decimal places. Use JOptionPane and the formatting techniques learned in chapter 3 for your output. Example output might be:
5750 Box Tickets sold at $250.00
28000 Sideline Tickets sold at $100.00
35750 Premium Tickets sold at $50.00
18750 General Admission tickets sold at $25.00
View Replies
View Related
May 6, 2014
I have been playing around all day trying to get this to increase the value of number by one after each new runner is added. How to get the value of number to increase after each record is added?
public class Runner
{
/* static variables */
/* instance variables */
private int number; // runner's number
private String name; // runner's name
private String ageGroup; // standard, junior or senior
private int time; // runner's marathon time in minutes
[Code]...
View Replies
View Related
Apr 11, 2013
I was making a pong game, part copied code off the internet, part my own code, part my friends code. It works well enough, but the ball starts at one speed, and stays the same. I would like to know how to make the ball slowly increase.
It is a java applet, which shouldn't casue any harm right?
My code:
Pong Applet
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Pong extends Applet implements MouseMotionListener, KeyListener {
[Code] .....
View Replies
View Related
Jul 7, 2014
I was wondering where is the memory allocated for an applet; by the browser; by the JVM; some applet specific java option? I get an out of memory error when running my applet (loading pictures).
View Replies
View Related
May 3, 2014
Here is what I'm trying to do using arrays.
gather sales amount for the week
display the total of sales
display the average of sale
display the highest sale amount
display the lowest sale amount
using occurrences determine how many times the amount occurred for the week
make a sales main
make a sales data
This is what i have so far but I'm confused on how to start the occurrence and where it would be placed in order to get the information from the array
public class SalesData {
private double[] sales; // The sales data
/**
The constructor copies the elements in an array to the sales array.
@param s The array to copy.
*/
public SalesData(double[] s) {
[Code] .....
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
Jul 19, 2014
My java code complies correctly runs and displays correctly but it is not calculating the annualSales * rate correctly.
/*
* The program will calculate annual salary and commission for a sales person.
* The user shall input the annual sales to calculate.
*/
package salescommission;
import java.util.Scanner;
public class SalesCommission {
[Code] ....
run:
The Salesperson earns a fixed annual salary of $10000.0.
Enter annual sales: 100000.00
The annual sales of the salesperson is $10000.0 using a 10% commission. (the is incorrect)
The total annual compensation of the salesperson is: $20000.0.
BUILD SUCCESSFUL (total time: 13 seconds)
View Replies
View Related
May 5, 2014
Whenever i perform any operation in my application Live Bytes of a particular Instance of a class increases by 1000.Although i perform the same operation everytime it always increases by 100 or 1000.Is this a memory leak or does these instances increase everytime we perform an operation.
View Replies
View Related
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
Jan 31, 2015
I'm trying to create a circular array which prints out 8 numbers that increase by one and don't exceed 9. If they do, the remaining numbers are printed from 0 on-wards. I have code below which does this job, but it doesn't really use an array to loop back.
Java Code:
package Practice;
public class Practice
{
public static void main(String[] test)
{
number(7);
number(9);
[code]...
View Replies
View Related
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
View Related
Apr 10, 2014
I am developing an application to share my client screen with server, it is working well on swing. But i want to develop as web application, i am trying to using applet. But i am facing the fallowing problem..,
1) The Applet screen also open and project also running well on server mechine. But unable to see the client screen on the server.
2) The problem may be to display the JDesktopPane or JInternalFrame.
My working Server Code extends withe JFrame..Java Code:
package remoteserver;
import java.awt.BorderLayout;
import java.awt.Container;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import javax.swing.JApplet;
import javax.swing.JDesktopPane;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
[code]....
View Replies
View Related