Create A Program That Calculate Price Of Carpeting For Rectangle Rooms

Apr 23, 2014

I am not getting any syntax errors but the program simply does nothing when I run it.

I literally just get "run: BUILD SUCCESSFUL (total time: 3 seconds)".

So basically, I need to create a program that calculates the price of carpeting for rectangle rooms.(multiply the area of the floor by the price per square foot of the carpet).

-The RoomDimension class should have two fields: one for length and one for width, and a method that returns the area of the room
-The RoomCarpet class that has a RoomDimension object as a field, a field for the cost of carpet per square foot, and a method that returns the total cost of the carpet

Here is what I have:

package roomdimension.java;
public class RoomDimension {

private double length=0;
private double width=0;
private final double area = length * width;

public void RoomDimension(double len, double w)

[Code] ....

View Replies


ADVERTISEMENT

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

Calculate Price And Quantity With Or Without Discount?

Oct 24, 2014

double price;
String PriceStr;
int quantity;
String QuantityStr;
PriceStr = JOptionPane.showInputDialog("Enter the price: ");
price = Double.parseDouble(PriceStr);
QuantityStr = JOptionPane.showInputDialog("Enter the quantity: ");

[code]....

So i tried to make it allows the user can continue pick the option and calculate the total of every time they select the option, mine is only 2 times.

View Replies View Related

Calculate Quantity / Price And Total Amount

Apr 10, 2015

How to calculate the qty and price and total of the amount in total column.

View Replies View Related

JSP :: Shopping Cart - Calculate Total Price

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

Create A Program That Will Calculate Different Tax Brackets

Oct 3, 2014

I have spent the past 12 hours on it and have gotten no where. I need to create a program that will calculate different tax brackets. I have tried all combinations I can think of and can't get it to work!!! I am literally about to go insane! I need the program to calculate tax will be 1% for anything up to $50000. If the tax is over $50000, you keep that 1% of $50000 and then add the remaining. So for an income in the second range, it would be 1% of $50000, and then 2% of (income - $50000). This then continues for each range.

The problem I'm having is getting it to display the correct interest rates. I am not asking for you to write it for me. I want to learn. But at this point I have exhausted all resources available to me.

import java.util.Scanner;
public class Project3taxinfo {
public static void main(String[] args) {
final double RATE1 = 0.01; //1% tax on the first $50,000
final double RATE2 = 0.02; //2% tax on the amount over $50,000 up to $75,000
final double RATE3 = 0.03; //3% tax on the amount over $75,000 up to $100,000
final double RATE4 = 0.04; //4% tax on the amount over $100,000 up to $250,000
final double RATE5 = 0.05; //5% tax on the amount over $250,000 up to $500,000
final double RATE6 = 0.06; //6% tax on the amount over $500,000

[code]....

View Replies View Related

Calculate And Display Price Of Each Object Each Year For 5 Years

Apr 18, 2015

For this program I am calculating the annual costs of 5 office supplies (user input) each with a 5.7% inflation. The user inputs the cost of each object and my program must calculate and display the price of each object each year for 5 years. I already have this part. What I need is how to add the total costs of all 5 supplies per year and display each total cost. Here is the program:

import java.util.Scanner;//Using keyboard to enter data
//Start of Class
public class OfficeSupplyCalculator {
//Start of Method
public static void main(String args[]) {
Scanner keyboard = new Scanner(System.in);
System.out.println("Enter the first item");

[Code] .....

At the moment all I get for the grand total loop is the same number showing up 5 times. I feel like the problem is how I am declaring the grandtotalperyear variable but I'm not sure what is wrong.

View Replies View Related

Calculate Total Price At The End Of Order - Decimal Format

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

Create A Program To Calculate Roots For 2 Degree Equation

Oct 14, 2014

I just created a program to calculate the roots for a 2. degree equation, When I first created my program, I defined the r1 and r2 as double, but got an error saying they needed to be defined as String, why is that?When should I be using string? I am new to java and I have mostly only used int, double and Boolean so far.

import java.util.Scanner;
import java.text.DecimalFormat;
public class c3e1 {
public static void main(String[]args){

[code]....

View Replies View Related

How To Calculate Area Of Triangle / Circle / Rectangle

Mar 3, 2015

package areatest;
import javax.swing.JOptionPane;
public class AreaTest {
 
public static double areaTriangle (double length, double width){ //How to calculate the area of a triangle
return .5f * length * width;

[Code] .....

When I try to get the area of a rectangle it gives me 9 no matter what input I give it. When I try to get the area of a triangle it gives me .5 no matter what input I give it. Same with the circle but it always gives me 12.56370...

View Replies View Related

Input Length And Width - Calculate And Print Perimeter And Area Of A Rectangle

Feb 16, 2015

Create a program to input the length and width of a rectangle and calculate and print the perimeter and area of the rectangle. To do this you will need to write a Rectangle class and a separate runner class. Your program should include instance variables, constructors, an area method, a perimeter method, a toString method, accessor and mutator methods, and user input. Your runner class should include 3 Rectangle objects. One default rectangle, one coded rectangle, and one user input rectangle. All methods should be tested in the runner class.

This is my code:

import java.util.Scanner;
 public class Rectangle {
double length;
double width;
public Rectangle() {

[Code] ...

What have I done??? I have created this program using the few different resources with which I am supplied, but I don't understand the resources.

View Replies View Related

Calculate Total Price And Display Total In Order Class

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

Invoice Program - Convert Strings For Quantity And Price To Numeric Types

Feb 12, 2015

In the test program, you will need to convert the Strings for quantity and price to numeric types. To do this, you could use the Integer.parseInt() method and the Double.parseDouble() methods. I'm not sure what he means by that. I attempted it in my program but I get these errors

Exception in thread "main" java.lang.Error: Unresolved compilation problems:
number cannot be resolved to a variable
description cannot be resolved to a variable
quantity cannot be resolved to a variable
price cannot be resolved to a variable
Duplicate local variable quantity
Duplicate local variable price
Syntax error on token "myInvoice", delete this token
The method getinvoiceAmount() is undefined for the type String

at InvoiceTest.main(InvoiceTest.java:7)

Code:
 
public class Invoice
{
private String number; //Instance variables
private String description;//Instance variables
private int quantity;//Instance variables
private double price;//Instance variables
 
 [Code] .....

View Replies View Related

Java Program That Specifies Three One-dimensional Arrays Names Price / Amount And Total

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

System For Emulating Conversation In Chat Rooms?

Oct 11, 2014

So for my current work I do a lot of chatting to customers, but I spent 80% of my time answering things that could be automated, I'd like to know where the best place to start would be for the following.

Being able to compile data on certain conversation parts,

for instance "How many employees do you have?/How many people work there?/how many people do you employ" would be a bunch of different ways of saying the same thing, so i could have a stock answer to that: "x employees work at Acme"

So what language and/or framework would be best for having a program like that running, and giving me an alert when it encounters a conversation direction it's not used to, so i can add in an option, so its sort of like I'm teaching at as we go, but I think it's a lot simpler than most AI haha.

Also a way of selecting and reading chat windows, like how old runescape bots used colours.

I'd like do all the data input myself, and I'd like to write or design the framework if possible, but I don't even know what keywords to use find out where I should start.

View Replies View Related

How Does Program Know To Calculate For Only One Year

Mar 26, 2015

how does the program know to calculate for only one year?

public class Interest2 {
public static void main(String[] args) {
double principal; // The value of the investment.
double rate; // The annual interest rate.
double interest; // The interest earned during the year.

[code]....

View Replies View Related

Program To Calculate Area Of Circle

Mar 11, 2015

I'm starting with my version of very basic program: calculating area of circle. And of course it doesn't get well. My question: what is wrong in this code?

public class circleAre{
double radious;
void putData(double radi){
radi = radious;

[Code] .....

View Replies View Related

Cannot Get Average Program To Calculate Properly

May 9, 2010

I am having a problem with my program. I can't get my program to calculate properly. Everything compiles and run but its just giving me a wrong answer. I am suposse to get 115.50 but instead I am getting .30...

order.java
public class Order
{
double salesTaxRate; //initializing a variable for the sales tax rate.
double subTotal; //initializing a varliable for the sub total.
double shippingCost; //initializing a variable for shipping cost.
double salesTax; //initializing a variable for sales tax.
double totalCost; // initializing a variable for totale cost.

[Code] ....

View Replies View Related

Java Program To Calculate Diameter?

May 6, 2014

Assume the tanker is a cylinder of length 19.35 feet and volume 1320 gallons. What is the diameter in feet of the tanker truck? To solve this problem, write a Java program to calculate the diameter. For full credit, your Java application must follow these specifications.

1. The program must interactively input the capacity of the tanker in gallons and its length in feet. This should be done in the main method of your Tester class.

2. The input data should then be used to construct a TankerTruck object. You will need to write the TankerTruck class.

3. A TankerTruck method should be used by main to calculate the resulting diameter of the truck in feet.

4. Your program should use the standard Java constant for the math constant PI.

5. The output should be displayed using fixed-point notation, rounding to one decimal place of precision

View Replies View Related

Calculate Rainfall Quarterly Program

Mar 29, 2015

//calculates rainfall quarterly program
 
import java.util.Scanner;
 public class SophiaKeyProgram1 {
 public static void main(String[] args) {
// TODO Auto-generated method stub
int numQuarter; //number of quarters in a year
double rainfall=0; //the amount of rain

[Code] ....

I have everything but the min and max numbers.

View Replies View Related

Create Little Program Which Enter Number / Program Says Triangle Exist Or Not

Mar 16, 2014

i want create little program which enter the number, ant program says triangle exist or not. So code :

import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

[code]...

So when i put first num like 1, next num like 2 and next num like 100 , program says Triangle exist.

View Replies View Related

Java Program Method To Calculate Distance

Feb 20, 2015

Write method distance, which calculates the distance between two points (x1, y1) and (x2, y2). All numbers and returned values should be of type double. Incorporate this method into an program that enable the user to enter the coordinates of the points, then calculate and display the distance by calling the method –distance.

I've tried numerous times to make it work and I'm on the right path, however I'm missing some things in the code to make my results look like this later on, which I've attached onto this post.

View Replies View Related

Program That Calculate Change Due To Customer By Denomination

Sep 20, 2014

write a program that calculates the change due to a customer by denomination; that is, how many pennies, nickels, dimes, etc. are needed in change. The input is to be purchase price and the size of the bill tendered by the customer($100, $50, $20, $10, $5, $1).

View Replies View Related

Write A Program Using Loop And Break To Calculate Value Of Pi

Oct 5, 2014

having some trouble doing this. Here are the requirements:

1)Write a program using loop and break to calculate the value of PI.
2)You can use the following equation to calculate PI. PI=4/1-4/3+4/5-4/7+4/9-4/11+4/13 etc.. The program shouldn't loop until the criteria is satisfied.
3)The criteria is the value of PI you get is very close to the “real” value (3.1415926), meaning that their difference
should be smaller than a very small numeric number, e.g., 0.0001).
4)The control structures you may need for this program are loop, if-else, and unlabeled break.
5)The output should have the format: for each iteration, it has iteration number and the corresponding value of PI until that
iteration. The last line would be the final value of PI.

Here is my code so far:

package ids;
public class IDS {
public static void main(String[] args) {
double pi = 0;
for(int i=1; i<=100000; i++){
if ((i%2)==0){
pi+=(4/(2*i-1));

[code]...

View Replies View Related

Creating Program With Constructors And Calculate Result

Feb 11, 2015

The end result is when I print the total it comes out to be 0. Trying to solve this

package pay;
import java.util.*;
public class manager
{
public manager(String string, int i, String type) {

[Code] ......

View Replies View Related

Program Will Not Calculate Or Print Out Intersection And Difference

Nov 19, 2014

I have to use methods and loops to code this program. Cannot use any java set or any built in java shortcuts!

import java.util.Scanner;
public class setPractice {
public static Scanner kbd;
public static final int MAXSIZE = 20;
public static void main(String[] args) {
kbd = new Scanner(System.in);

[Code] .....

This is the input I put in my code and this is the output:

How many numbers will be in the 1st set: 3

Enter list of integers for 1st set:
34
2
56

The ascending order for 1st is:
2
34
56

How many numbers will be in the 2nd set: 4

Enter list of integers for 2nd set:
56
2
33
6

The ascending order for the 2nd set is:
2
6
33
56

The intersection of the two sets is: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

The difference of A-B is:

View Replies View Related







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