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
ADVERTISEMENT
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
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
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
Mar 19, 2014
I need to create a simple Java program for a commission calculator with the following requirements: I need to ask the user to enter their total sales (as a double) in at the keyboard and I need to use "if" statements to tell them their commission (sales * commission rate) using the following criteria:
o < $8000 in sales – Commission rate = 10%
o $8000 to $12000 in sales – Commission rate = 12%
o $12000.01 to $18000 in sales – Commission rate = 15%
o $18000.01 to $20000 in sales – Commission rate = 18%
o > $20000 in sales – Commission rate = 20%
Then for the output the user’s Commission in a well formatted way (use the DecimalFormat class) .In comment blocks have a description of what the program does.
import java.util.Scanner;
public class CommissionCalculator
//This program calculates the commission of sales
{
public static void main(Strings[] args)
{
// create a scanner
Scanner input = new Scanner(System.in);
//define variable
double sales; //inputted sales amount
double commission = 0; //commission pay amount
[code]....
View Replies
View Related
Feb 17, 2014
I have a form with primefaces input text(p:inputText).Many of the input text values are of the type currency in dollars.When i try to use ,it mandates the user to include $ symbol prepended to the value.Is there any way using which on blur of the field the dollar symbol is prepended and the number gets formatted with proper commas.
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
Apr 10, 2015
How to calculate the qty and price and total of the amount in total column.
View Replies
View Related
Oct 16, 2014
Having just started college, Bob has been busy looking for a part-time job to fund his new college social life and after only two weeks of looking he has managed to get two job offers! Each job comes with different hours, basic rates of pay and over-time rates so he needs to work out which would get him the most money.
Develop an application that would allow Bob to enter his basic pay rate, his number of regular hours work per week and his number of overtime hours per week. The application should then calculate and display Bobs total basic pay for the week, his overtime pay for the week and his total pay including overtime.
Your application should use instantiable classes to separate the calculations from the user input and output.
Save the instantiable class as Pay.java
Note: The overtime rate is 1.5 times the basic rate of pay
This is my instantiable class code which compiles correctly
public class Pay{
//Declare Data members/Variables
private double pay;
private double hours;
private double overtime;
private double totalBasicPay;
[Code] .....
My errors in the second bit of code that i have never seen before
"C:UsersAndreDownloadsPayApp.java:25: error: no suitable method found for println(<null>,String)
System.out.println(null,"Please enter Basic Pay");
^
method PrintStream.println() is not applicable
(actual and formal argument lists differ in length)
[Code] .....
View Replies
View Related
Jul 2, 2014
my task is to add a few functions to an example calculator. I managed to add a divide button but I simply can't figure out how to add a working Pi and reciprocal function.
package newjavaproject;
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
public class CalculateurNC extends Applet {
[code]....
View Replies
View Related
Oct 20, 2014
Why I am getting errors for this program I (tried) to write. I am new to java.
import java.util.Scanner;
public class TheBarkingLot {
public static void main(String args[]) {
int n;
Scanner input = new Scanner(System.in);
System.out.println("How many large dogs are boarding today?");
[Code] ....
View Replies
View Related
Jan 24, 2015
im considered quite the "javanoob" as my account name states..The assignment is to basically take a number that is entered by a user, and based off what they type in, display a corresponding grade letter. For example, if they enter a number between 90-100, they should receive a response that they received an "A". Now, this is fairly simple using an if/else statement, but my professor wanted us to implement this, using a switch case to teach us the difference.
import java.util.*;
public class SwitchTest
{
public static void main(String[] args)
{
Scanner scan = new Scanner(System.in);
System.out.println("Please enter a number to find out what letter grade you have recieved");
[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
Jul 8, 2014
I want a simple jsp page that performs basic operations on numbers such as addition, subtraction, multiplication, division and modulus . How to run that file?
View Replies
View Related
Dec 2, 2014
Recently I have missed a few weeks of my class due to family emergencies. Because of this I have missed very important lectures. My professor has assigned me the following assignment:
Prices Write a Java program that specifies three one-dimensional arrays names price, amount, and total. Each array should be capable of holding 10 elements. Using a loop, input values for the price and amount arrays. The entries in the total array should be the product of the corresponding values in the price and amount arrays. After all the data have been entered, display the following output:
Total Price Amount
==== ==== ======
Under each column heading display the appropriate value.
I know how to display everything using printf, how to create the actual arrays and define the array size, but I am confused on how and what loop to use and how to construct it. This is what I have managed to write up so far:
import java.util.Scanner; // Imports the Scanner class
import java.text.DecimalFormat; // Imports the DecimalFormat class
public class Prices
{
public static void main(String [] args)
{
double[] price = new double[10];
double[] amount = new double[10];
double[] total = new double[10];
// Create a new Scanner object
Scanner keyboard = new Scanner(System.in);
} //End of main method
} // End of public class
View Replies
View Related
Apr 7, 2014
I'm doing this project in JSP.net, with html. and in one of the web pages, what I'm doing is that, a person is transferring an amount to someone else, and if the transfer amount is more than the account balance, then he cannot transfer. else, save details in a table.
Here's the code I've used
<%
String t1=request.getParameter("text1");
String t2=request.getParameter("text2");
java.util.Date date1 = new java.util.Date();
SimpleDateFormat ft = new SimpleDateFormat ("dd/MM/yyyy");
int tamt = Integer.parseInt(t2);
int bamt = 0;
[Code] .....
But when i enter the fields and click the submit button in the form, to save it in the table, i get the error:
"org.apache.jasper.JasperException: java.lang.NumberFormatException: null"
(I've attached a screen shot of the error) : NumberFormatException.bmp (750.98K)
What does this mean? how do i find the line in the code that has the error?
View Replies
View Related
Sep 9, 2014
How can i write a java program that simulate a simple calculator that performs the basic arithmetic operations of JAVA. (JOption Pane and Repeat control structure)
Example : Addition, Subtraction, Multiplication, Division.
The program will prompt to input two floating point numbers and a character that represents the operations presented above. In the event that the operator input is valid, prompt the user to input the operator again.
Sample Output :
First number 7
Second number 4
Menu
<+> Addition
<-> Subtraction
<*> Multiplication
</> Division
Enter Choice: * <enter>
The answer is 28.
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
Nov 27, 2014
A wages calculator application is required that can determine the total cost of crew departing from the port on that day. To do this, the application reads from an itinerary text file containing each ship being loaded in the port that day, in the following format:
<ship id>
<journey id>
<l> // where <l> is the length in hours of the journey
<s> // where <s> is the number of crew for the ship for this journey
<rate> // for each s, <rate> is hourly rate of pay
Your application must calculate the total cost of the crew for each ship/journey and then compare it with a "recommended maximum journey cost" (RM) amount typed in by the user when the application is first run. If the total amount is less than or equal to RM then the details must be written to the screen and to an output text file called wagedaily.txt. If the amount is larger than RM then the results must be written to the screen only. Messages to the screen must indicate whether the crew cost is less than, equal to or larger than RM.
Your application should find the ship with the highest crew cost that is below RM and print this out as the final piece of output to the screen.
It has given me a bunch of ships and numbers to play around with in the code, here they are:
Monarch
M141
16
6
10.5
10.5
[Code] ....
View Replies
View Related
Feb 12, 2014
I am new to java and I have this assignment that I started but I am now stuck . The instructions are:
Create an ElapsedTimeCalculator class that computes the amount of time that passes between a starting time and an ending time, in military format.
For example, suppose the two times are 1445 and 1730. Then the program output should look something like this:
Start time:1445
End time: 1730
Exactly 2 hour(s) and 45 minute(s) have passed.
Total elapsed time in minutes:165
Total elapsed time in hours:2.75
ElapsedTimeCalculator Class Specifications:
1.Your class will have a constructor that takes two parameters: the starting time and the ending time in military format
2.Your class will also have these methods:
-Get method to return the starting and ending times
-Set method that resets the starting and ending times to values passed as parameters
-a method that returns the hour portion of the elapsed time
-a method that returns the minute portion of the elapsed time
-a method that returns the total elapsed time in minutes
-a method that returns the total elapsed time in hours
Now here below you can see what I have so far...
public class ElapsedTimeCalculator {
private int startTime, endTime;
private int hours;
private int minutes;
private int seconds;
//constructor
ElapsedTimeCalculator(int start, int end)
[Code] ....
I don't have any errors so far, I am more stuck on how to begin a method that returns the hour, minute, etc.. (the third bullet).
View Replies
View Related
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
View Related
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
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
Feb 27, 2014
In the code below, under calculations, I have x=totalPrice+xXxXxX. Obviously the x's were just place holders, but I wanted to know if there was any way to add something there so the program would tally the totalPrice, store it in the x variable outside the loop, so when the loop ended it would display the total price from all the loops added together where I have System.out.println("TOTAL OF ALL ORDERS: $"+ round.format(x)); at the very end.
Java Code:
import java.util.Scanner;
import java.text.DecimalFormat;
public class ModifyOrderV2TEST
{
public static void main(String [] args)
{
//Rounding
DecimalFormat round = new DecimalFormat("0.00");
[Code] ....
View Replies
View Related
Sep 12, 2014
I need to create a simply application that would display the results of two dice thrown five times and the total of those results. This is shown below in the attached file.
The problem is, I have a do-while loop that loops 6 times. Inside the loop, I have 2 random.nextInt(5) that generate random numbers. But how can I output the total? How can I make a variable equal to the sum of the two random numbers if the two random numbers are located inside a do-while loop?
Attached below is also the code I have thus far.
(Attached below is both files: what it needs to look like, and what it currently looks like)
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