Carpet Calculator Program With Aggregations?

Nov 26, 2014

I'm doing a Carpet Calculator Program with aggregations and can't seem to get my RoomCarpet class to work properly. This is what I have so far:

package roomDimensions;
/*
*
* Raul Caltenco

[Code].....

View Replies


ADVERTISEMENT

Program That Compute Cost Of Painting And Installing Carpet In A Room

Jan 30, 2015

I need to create a code for this asign:

Write a program that computes the cost of painting and installing carpet in a room. Assume that the room has one door, two windows, and one bookshelf. Your program must do the following:a. Prompts the user to enter, in feet, the length, width, and height of a room.

A. Read the dimensions of the room.

b. Prompts the user to enter the width and heights, in feet, of the door, each window, and the bookshelf. Read these quantities.

c. Prompts the user to enter the cost, per square foot, of painting the walls. Read these quantities.

d. Prompts the user to enter of cost, per square foot, of installing carpet. Read these quantities.

e. Output the cost of painting the walls and installing the carpet.

View Replies View Related

Grade Calculator Program

Nov 12, 2014

how to I modify my program so that it asks the user how many studens are in the class then according to the value the user inputs that is how many times the program will ask the user for a grade. Once the graded are entered it will then output the class average, minimum, and maximum. I believe that you'd use a for loop yet I am troubled.

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

[code]...

View Replies View Related

Grading Calculator In Java Program?

Sep 26, 2014

i have a similar problem but what i need to do is to detect an exused absent of which in my notepad is represented by 00 and 0 being an unexcused absent, anyway if a student has an excused absent example a quiz for that day will be deducted from the total quizzes example if i was the teacher and had 2 quizzes of 10 items each and she was absent in one of the quizes instead of let say her score was 9 on the first quiz it should go 9/10 and if it was an unexcused absent 9+0/20 anyway this is my java code and notepad example

import java.io.*;
import java.util.*;
import java.lang.*; 
public class GradingSystem {
public static void main (String[] args) throws FileNotFoundException

[code]...

View Replies View Related

Program Calculator Using Switch Case

Oct 14, 2014

I am making a programme for a calculator to - Divide, multiply, add and subtract. I have the code written but when I am running it and trying to add it was for some subtracting ....

import javax.swing.JOptionPane;
public class calculator3 {
public static void main(String[] args){
String number1,number2,operatorstring;
double result=0,a,b;

[Code] ....

View Replies View Related

Make A Simple Calculator Program

Mar 11, 2015

i am working on my assignment in Compro 2, we are ask to make a simple calculator program

here's my code;

import javax.swing.JPanel;
import javax.swing.JButton;
import javax.swing.JFrame;
import java.awt.BorderLayout;

[code]...

View Replies View Related

Calculator Program - Using Decimal And Operators

Oct 20, 2014

How do I get the code to use decimals? Also whenever you input 1, 2 or 3 as one of the operators, it always does that operator as well as the 4th operator at the end. So it always does subtraction. However when you use 4 as the only operator it works perfect.

import java.util.Scanner;
public class Program05 {
public static void main(String[] args) {
Scanner stdIn = new Scanner(System.in);
 double left;
double right;
 
[Code] ......

View Replies View Related

Calculator Program - Use Strings And Methods To Include Arrays

Jul 23, 2014

My assignment is to essentially update a calculator program that uses strings, and methods, to include arrays. How to create and call an array that the user defines the size of and then inputs the numbers to fill the array. Here's the example my prof gave us of what the output should look like:

Menu
1. Add
2. Subtract
3. Multiply
4. Divide
5. Dot product
6. Generate random array
7. Quit

What would you like to do? 1

How many values are in the arrays? 3

Enter the values in the first array, separated by spaces:
2 4 6

Enter the values in the second array, separated by spaces:
1 3 5

The result is [3.0, 7.0, 11.0]

How to create an array that would allow the user to define the size of the array and then inputs the values for the array? I'm completely lost. I never should have taken java as an online class.

View Replies View Related

Console Calculator Program - How To Split Array Of Strings

Apr 22, 2015

I'm writing a command line application of a calculator in Java. I need to be able to (as per program requirements) split the array of strings (6+3) into an array of strings? How would that be done? I know you can use the split method, but I am not really sure how that wold work to perform math with them?

On a side note: for this application, how could you make the program accept a variety of different lengths of strings to perform math with them?

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

Tip Calculator For Fun

Oct 18, 2014

So, I'm working on a Tip Calculator for fun. I have everything worked out for the most part. The feature I am trying to add is to give the user the amount of change they'll get back from their transaction. I do not ask the user any information other than what is their bill.

Please enter your bill total : 5.50
Please enter your name : some name
Total : 5.50
Tax : 0.48 -- Based off a tax rate of 8.75%
Total with Tax : 5.98 --
20 percent Tip : 1.10
Total with Tax and 20 percent Tip : 7.08
Total change : <-- I believe this will be about $2.92

I want the total bill to round to the nearest $10 value (e.g. for $5.50, calculate bill to $10. For $13.00, calculate bill to the $20.00, and so on... This way I get an accurate amount of change to give back to the user.

View Replies View Related

MVC Calculator - How To Get It To Actually Calculate

Sep 28, 2014

I made a MVC calculator. I was wondering if you could take a look at my design and if I was on track. I am still working on getting it to actually calculate something. All the buttons respond and print text on the JTextField but it is not calculating.

package calculator.MVC;
import javax.swing.JButton;
import javax.swing.JTextField;
public class CalculatorModel {
private int sum;
private int number;
private char opt;

[code]....

View Replies View Related

Calculator Only Return 0.0?

Sep 2, 2014

I am making a calculator in Java. However, when I press the "=" button on my calculator, it always returns 0.0, no matter what. I don't understand why? The code is below:

import javax.swing.*;//import the packages needed for gui
import java.awt.*;
import java.awt.event.*;
import java.util.Arrays;
import java.util.List;
import static java.lang.Math.*;
public class CalculatorCopy {

[Code] ....

View Replies View Related

How To Add Loop In Calculator

Mar 11, 2015

import javax.swing.*;
public class BasicCalculator{
public static void main (String[] args) {
String output="";
double n1,n2;
String operation;
operation= JOptionPane.showInputDialog("Please enter your operation");

[Code] ....

How to add a loop in this problem:

View Replies View Related

While Loop Pay Calculator

Dec 2, 2014

I have the basic workings of this program just doing all the printing at the end is throwing me off. Anyway here are some of the requirements and my code:

1. Allow the user to input an individual's hours worked.
2. Accumulate the total regular hours worked, the overtime hours worked, the amount of the regular pay, the amount of overtime pay, and the total payroll, for all of the employees entered.
3. Allow the user to enter a zero (0) as the Boolean expression to end the loop.
4. When the loop ends print out all of the accumulated totals with appropriate labels, each on a separate line.

import java.util.Scanner;
public class WhileLoopPayCalc
{
public static void main(String [] args)
{
final double REGULAR_HOURS = 40f;
final double HOURLY_WAGE = 12.5f;
final double OVERTIME = 1.5f;

[code]....

View Replies View Related

Calculation In Awt Calculator

Jul 10, 2014

I am facing problem during calculation in my awt calculator. It is showing NumberFormatException. Below is part of code.

if(e.getSource()==b14)//On button 14, label is "/"
{
String v1=tf.getText().toString();
num1=num1+Integer.parseInt(v1);//num1 is as integer variable
tf.setText("");//tf means textField
}else

[code]....

View Replies View Related

Calculator In Java

Oct 28, 2014

I can not this to work correctly.

public static void main(String[] args) {
FloatWrapper x1=new FloatWrapper(0);
FloatWrapper x2=new FloatWrapper(0);
do{
switch(menu()){
case 'a': if(dataInput(x1,x2)) add(x1,x2); break;
case 'b': if(dataInput(x1,x2)) subtract(x1,x2); break;

[code]....

View Replies View Related

Trying To Create A Calculator

Sep 16, 2014

I'm new to java and have been coding for a few hours. I tried to create a calculator (Which has no GUI, just text inputs)which will let you select how to process the two integer (Add, minus, times etc.) I cant seem to get it to work. I will put in the process way such as times and have entered two integers and every time it doesn't work. Here is my code:

import java.util.*;
public class Calculator
{
public static void main (String args[])
{
int input1 = 0;
int input2 = 0;
int answer = 0;

[code]....

View Replies View Related

Create A Calculator With JCreator

May 24, 2010

I have got a problem when coding a java program to create a calculator with JCreator. How to write codes for decimal point.

Decimal point should not be set to the text more than 1 time until an operator is pressed. How can I use a Boolean value to solve this problem.

View Replies View Related

Calculator That Change Input Value Into Another Value

Nov 14, 2014

I am currently working on a small java programm. I use netbeans for it. And obviously I am new to java.

Basically its a calculator that change the input value into another value: like 10 € into whatever $ and same with Inch and Centimeters.

Therefore I need a second jDialog Form where i can change the factors for the calculator and start the calculator again.

Here is my problem: I can open the second Dialog but if I want to change the factor it doesn't change the value in the variable and the second calculator frame is with the old factors. It seems the double variable isn't working globally

I will add the files later when i find out how?

View Replies View Related

PostFix Calculator Project?

Apr 2, 2015

So I am working on a PostFix calculator that is used in command line for a class project, and I am having a little trouble on developing a memory for it. I have been told to create a hashMap and I have researched it and understand the basics of it. I have the calculating method working, but what I am having trouble trying to implement a way for the user to declare variables. For example this what the user should be able to do:

> a = 3 5 + 1 -
7
> bee = a 3 *
21
> a bee +
28

[code]....

I just need to be able to save the answers as a variable the User names, such as the example and let the user be able to use the variables later.

View Replies View Related

Random Number Calculator

Feb 1, 2015

the program basically has a random number generating, and I want to ask the user to try to guess the number, and keep guessing until the number is right. In addition to this, I need to put in extra conditions for too high or too low by 10. So for example, if they user guesses a number and its off by more than 10, then it prints that they guessed too high, and if its below 10 they guessed too low.

import java.util.*;
public class RandomNum
{
public static void main(String[] args)
{

Scanner scan = new Scanner(System.in);

[code].....

Modify the program to keep the user trying to guess the number till he/she gets it right, and stop once you guess the right number.Too high, high, too low, too low( If it's off by more than 10 = way too high, if its less than 10, way too low)

View Replies View Related

Basic Calculator Functions

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

How To Make Calculator Using Stacks

Feb 5, 2014

I got to make a java code for my class. I must make a calculator using stacks. I have a code but i got some mistakes. Here is the code

Java Code:

package stackscalc;
import java.util.Scanner;
import java.util.Stack;
import java.util.EmptyStackException;
class Arithmetic {
int length;
Stack stk;
String exp,

[Code] .....

View Replies View Related

Else Without If Error - Simple Calculator Using JOP

Oct 8, 2014

import javax.swing.JOptionPane;
public class Calculator {
public static void main ( String args[] ) {
double n1 = Double.parseDouble(JOptionPane.showInputDialog(" Enter first number: "));
double n2 = Double.parseDouble(JOptionPane.showInputDialog(" Enter second number: "));
String x = JOptionPane.showInputDialog("Enter operator: ");
double result;

[code].....

Write a program that mimics a calculator. The program will need to accept as input two numeric double values, and accept the operation to be performed as the third input. The operation to be performed will be input in the form of the character representing the java operator for the operation to be performed (i.e + for addition, - for subtraction, * for multiplication, / for division, or % for modulus). Once the program has read these 3 inputs it should output the numbers, the operator, and the result. (For division, if the denominator is zero, the program will output an appropriate message (i.e division by zero is an invalid operation). Please use the JOptionPane class for both accepting the required inputs and for the required output demonstrated below.Some sample output may look as follows:

3 + 4 = 7
13 * 5 = 65
10 / 3 = 3.33333333

Error Messages:
3 errors found:
File: /Users/gcaruso/Documents/CISS 110/Module 3/Module 4/Calculator.java [line: 23]
Error: /Users/gcaruso/Documents/CISS 110/Module 3/Module 4/Calculator.java:23: 'else' without 'if'
File: /Users/gcaruso/Documents/CISS 110/Module 3/Module 4/Calculator.java [line: 31]
Error: /Users/gcaruso/Documents/CISS 110/Module 3/Module 4/Calculator.java:31: 'else' without 'if'
File: /Users/gcaruso/Documents/CISS 110/Module 3/Module 4/Calculator.java [line: 37]
Error: /Users/gcaruso/Documents/CISS 110/Module 3/Module 4/Calculator.java:37: 'else' without 'if

View Replies View Related

Make A Calculator Using Java GUI

Jul 29, 2014

I am trying to make a calculator using Java GUI. I've managed to make an ActionListener and add it to a button, but I've made an error in my code that I'm unsure of how to solve. Because of how I've written the code, only one number can be placed in the text field. For example, the an ActionListener for the three button on the calculator was added to the button, but no matter how many times the user presses the button, only one 3 will appear in the text field. The code is below:

import javax.swing.*;//import the packages needed for gui
import java.awt.*;
import java.awt.event.*;
public class Calculator {
public static void main(String[] args) {
JFrame window = new JFrame("Window");//makes a JFrame
window.setSize(300,350);

[code].....

As you can see, because the compiler forces the String variable to be final, so when the user presses the button, the code simply shows how a space character and three character would look like, because the String variable can't change. How do I write my code so that every time the user presses the button, a character is added to the text field?

View Replies View Related







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