Code Not Calculating Annual Sales Rate Correctly

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


ADVERTISEMENT

Average Program - Divisible Numbers Not Calculating Correctly

May 21, 2015

For some reason, the averages aren't calculating correctly. I'm aware I need to convert to double if I'm dividing by an odd amount but that itself isn't the issue. It's just simple easy divisible numbers that are not being calculated correctly. For instance, (10 + 10 + 10 + 50) / 4 = should be 2 but I get 10.

Here is the code:

import java.util.Scanner;
public class Avg {
public static void main(String[] args){
Scanner inputGains = new Scanner(System.in);
int userInput = inputGains.nextInt();

[Code] ....

View Replies View Related

Electricity Bill Project - How To Incorporate Rate Per Month And Three Rate Zones

Jan 30, 2014

I am not sure how to incorporate the rate per month and the three rate zones.

Problem: Electricity billing charges vary with the season and amount used.

Southwest Power and Light provides electricity at the basic rate of $ 0.10 per kilowatt for the months December through February, 0.12 per kilowatt for the months of March through May, and 0.15 per kilowatt for the remaining months.

Customer billing is divided into three rate zones: 0-350 kilowatts, 351 – 500 kilowatts, and above 500 kilowatts. Usage up to 350 kilowatts is billed at the basic rate. Usage between 350 and 500 kilowatts is billed at 10% above the basic rate. Above 500, billing is 25% above the basic rate. These surcharges apply only to the usage falling within the respective rate zone.

View Replies View Related

Eclipse Java Programming Sales Commissions Array Sales In Ranges

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

Read File Of Sales Records And Produce Sales Report

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

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

Tax Return - Constructor Calculate Tax Liability Based On Annual Income And Percentage

May 12, 2014

With fields that holds a tax payer social security number, last name, first name, street address, city zip code, annual income, marital status and tax liability, include a constructor that requires argument that provide values for all other fields other than the tax liability. the constructor calculates the tax liability based on annual income and percentage in the ff table

Income
0-20,000
20,000-50,000
50,000 and over

marital status
single married
15% 14%
22% 20%
30% 28%

View Replies View Related

Make A Program To Calculate Average Temperature And Annual Precipitation In Jacksonville

Oct 4, 2014

I wasn't supposed to use the % in front of f.I have to make a program to calculate the average temperature and annual precipitation in Jacksonville. I get this error on line 49:

java.util.IllegalFormatPrecisionException;
null (in java.util.Formatter$FormatSpecifier)

I don't get any errors during compilation.Here is my code (I'm not using the system selection yet):

import java.util.Scanner;
public class AnnualClimate1
{
public static void main(String[] args)
{
double[] temperaturesInJacksonville = {53.1, 55.8, 61.6, 66.6, 73.4, 79.1, 81.6, 80.8, 77.8, 69.4, 61.7, 55.0};

[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

Adding A Tick Rate To Game To Unlock FPS?

Nov 25, 2014

I need to add a tick rate so i can unlock the FPS. Here's the main render class/update class/game loop class.

Added back the formatting

Java Code:

package com.educodes.Main;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.image.BufferedImage;

[Code] ....

View Replies View Related

Saving Student Grades In Int Array - Pass Rate 50

Apr 8, 2014

prompts user for the grades of each of the students and saves them an int array called grades. Your program shall check that the grade is between 0 and 100. program should then check if the grade is equal to or greater than 50, where 50 is the pass rate.

A sample output :

Enter the number of students: 3
Enter the grade for student 1: 55
Enter the grade for student 2: 108

Invalid grade, try again...

Enter the grade for student 2: 56
Enter the grade for student 3: 57

The average is 56.0
The maximum is 57
The minimum grade is 55
The number of fails is 0
The number of passes is 3
..

I am quiet stuck on this one.

View Replies View Related

Calculator Program - Print Heart Rate Ranges And User Information

Jan 26, 2014

I am attempting to make a heart rate calculator program. Here is a little overview of what I am trying to do. It must use a constructor and get and set methods. It must print heart rate ranges and the user's information(age).

// Use scanner to get inputs
import java.util.Scanner;
 
// Declare class
public class HeartRates {
private int Age;
private int DayOfBirth;
private int MonthOfBirth;
private int YearOfBirth;
private double MaxHeartRate;
private double MinTargetHeartRate;

[Code] ....

View Replies View Related

Create Array / Store 5 Objects And Calculate Total Price - VAT Rate

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

Write Class That Accepts User Hourly Rate Of Pay And Number Of Hours Worked

Feb 22, 2014

Here is what im trying to do

Write a class that accepts a user's hourly rate of pay and the number of hours worked. Display the user's gross pay (gross pay = hours worked * hourly rate), the tax withheld (tax withheld = gross pay * tax rate) and the net pay (net pay = gross pay - tax withheld).Use a named constant for storing the tax rate of 0.15

Here is my Code:
 
import java.util.Scanner;
 class Tutorial
{
public static void main(String[] args);

[Code]....

View Replies View Related

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 View Related

Software Sales Program

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

Sales Opportunity - Summing Up Variables?

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

Average Daily Sales For Store

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

JGrasp - Writing A Program For Ticket Sales

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

Array With Occurrences - Gather Sales Amount For The Week

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

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

Write A Sales Tax Program With JOptionpane / Illegal Start Of Expression

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

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 View Related

Why If Statement Isn't Working Correctly

Apr 23, 2015

I am building a program that when you enter 1. it allows you to setup an item. However running my code my second if statement runs through.

import java.util.Scanner;
public class InventorySystem {
public static void main(String [] args) {
Scanner input = new Scanner(System.in);
int count=0;
int inputEntered=0;
int numberOfItems=0;
double cost=0.00;
String item;
String description;
 
[code]...

View Replies View Related

How To Read A File Correctly

Feb 13, 2014

So i am creating a File object which has a text file passed to it. I then try to do logic with it using a BufferedReader. However, I get a FileNotFoundException on the using my code below. The Error is on the BufferedReader line. I

Java Code: System.out.println("--Reading text file--");
File file = getFile(c,fileName) // Returns a File object.
System.out.println(file); // Shows me the file is looking correct. Displays contents to console.
BufferedReader br = new BufferedReader(new FileReader(file));
System.out.println("BUFFERED");
while((line = br.readLine()) != null) {
try {
// Do Logic
}
catch(Exception ex){
ex.printStackTrace();
}
br.close(); mh_sh_highlight_all('java');

View Replies View Related

If Else / Switch Not Outputting Correctly

Jan 27, 2014

Trying to learn switch statements. Can't figure out what I am doing wrong.

java Code:

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

[code]...
When I run, it makes me enter letter = null and it wont output correctly.

View Replies View Related







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