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
ADVERTISEMENT
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
View Related
Mar 16, 2015
HTML Code:
import java.util.Scanner;
public class BellmanFord {
private int distances[];
private int numberofvertices;
public static final int MAX_VALUE = 999;
[Code] ....
I am trying to display two types of table one with initial cost and another one with new cost. Based on the java code here i already have one table but don't know how to display another table.
Attached is the sample output that i am aiming for. The output table for the above code is:
Enter the number of vertices
6
Enter the adjacency matrix
0 4 0 0 -1 0
0 0 -1 0 -2 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 -5 0 3
0 0 0 0 0 0
Enter the source vertex
1
distance of source 1 to 1 is 0
distance of source 1 to 2 is 4
distance of source 1 to 3 is 3
distance of source 1 to 4 is -6
distance of source 1 to 5 is -1
distance of source 1 to 6 is 2
View Replies
View Related
Oct 9, 2014
I'm trying to write a program that will output the total number of large,medium,and small pizza along with the average cost of an order. I'm stuck on this error , "Else without if" on line 48 else ...medium.
import java.util.Scanner;
public class PizzaOrder
{
public static void main(String[] args)
{
Scanner input = new Scanner (System.in);
double cost,total, average;
String name,response,size,type;
int count,l,m,s;
[code]....
View Replies
View Related
Oct 26, 2014
My homework assignment is: Using a do-while statement, write a Java program that continuously requests a grade to be entered. If the grade is less than 0 or greater than 100, your program should display an appropriate message informing the user that an invalid grade has been entered; a valid grade should be added to a total. When a grade of 999 is entered, the program should exit the repetition loop and compute and display the average of the valid grades entered. Run the program on your computer and verify the program using appropriate test data.
When I run it, I don't get the correct average. I know that i'm supposed to enter 999 to exit the loop and to display the average, but 999 is being added with the loop. I'm not sure how to make it not do that.
//stephanie
import java.util.Scanner;
public class gradeAverage
{
public static void main(String[] args)
[code]....
View Replies
View Related
Apr 2, 2015
Four experiments are performed, each consisting of six tests. The number of test results for each experiment is entered by the user. Write a Java program using a nested loop to compute and display the average of the test results for each experiment.
You can run the program by entering the following test results:
Experiment 1 results:23.231.516.927.525.428.6
Experiment 2 results:34.845.227.936.833.439.4
Experiment 3 results:19.416.810.220.818.913.4
Experiment 4 results:36.939.549.245.142.750.6
View Replies
View Related
Dec 21, 2014
I am getting this null pointer error when i m installing subeclipse.
Also in log file this error i found.
unable to locate .myeclipse.properties file
Problems occurred when invoking code from plug-in: "org.eclipse.jface".
View Replies
View Related
Sep 24, 2014
I am doing the home work to create a mini hotel reservation system which should be able to write the data into .txt file.
case study:
1. Have 2 different types of room (1- Suite 2- Deluxe)
2. Room Rate (Suite - $500per night, Deluxe - $300per night)
3. Both rooms can accomodate 2adults and 2childs
4. Checkin time: 2pm, Checkout 11am
5. Room status = occupied once guest checkin, Room status = vacant once guest checkout
6.For checking require (ID,Full Name,Address,Nationality,Flight no/Vehicle Reg no,number of people,check-in date, check-out-date,payment detail
7.Front desk search the vacant room to be assigned to the guest
Functions:
1. View all rooms
2. Add Customer to a room
3. Display available room
4. Delete customer from a room
5. Find room from customer name
6. Exit
Files:
One file use to store room info. (to be retrieved by program)
One file use to store rate info. (to be retrieve by program)
One file use to store the booking details (to be created and write by the program).
Currently I have write a program but only compiling and display the output to the console. How to modify my code below to be able to save to the .txt file
Here is the code:
import java.util.*;
import java.io.*;
class Customer {
private String name;
private int room;
public void setName(String name) {
this.name=name;
[code]...
View Replies
View Related
Sep 12, 2014
I have to store the name SD array and display the room and floor no. whose name is entered but i am having a problem with the logic part. The answer is coming to be wrong
import java .io.*;
class hotel
{
public static void main()throws IOException {
InputStreamReader read = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(read);
String ar[][] = new String[5][10];
[Code] ....
View Replies
View Related
Jul 14, 2014
I want to make a simple Table Tennis game. I have 2 drawing classes. 1st should draw oval and 2nd rectangle. But second class, which should draw rectangle doesn't work and if i use it together with oval class, then oval doesn't appear too.
Java Code:
public static void main(String[] args) throws InterruptedException
{
Intro i = new Intro();
Pall pall = new Pall();
Laud laud = new Laud();
i.frameID().add(pall); // this adds oval
i.frameID().add(laud); // this adds rectangle
i.frameID().pack();
i.frameID().setSize(400, 400);
[code]...
View Replies
View Related
May 13, 2014
I am attempting to make some Java2D shapes by wrapping them in subclasses of JComponent and giving them functionality. Unfortunately after defining paintComponent and adding it to the JPanel the shape is not showing up. As in my last thread the code is mostly irrelevant but the perhaps worth a skim. The only methods truely relevant are the paintComponent method in my shape and Sandbox constructor.
Java Code:
public class Sandbox extends JPanel
{
private Timer timer;
private Circle c;
public Sandbox()
{
c = new Circle();
add(c);
setPreferredSize(new Dimension(400, 300));
[Code] ....
View Replies
View Related
Dec 10, 2014
I am currently trying to make a Tetris game, so far I've got a class drawing that extends a JPanel as my canvas, a class Square that is 1 square(20 by 20) and a class LineShape that should draw 4 squares above each other. The class Frame way below is merely to set things up.
Currently i'm able to draw objects of my class Square, so I made a class LineShape that combines both and makes a 4Square long line.
My problem is when I try to draw an object of the class LineShape, it shows nothing, removes what is already painted(the square) and gives an error message:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at LineShape.<init>(Screen.java:96)
at Drawing.paint(Screen.java:79)
I put my classes together so you can copy paste and run, make a new screen to start, to see the problem occur, go to the drawing class's paint method and uncomment these lines:
// LineShape shape = new LineShape(this);
// shape.paint(g);
Below are my classes:
import javax.swing.*;
import java.awt.*;
public class Screen {
private Frame frame;
private Frame inputFrame;
private JPanel panel;
[Code] ....
View Replies
View Related
Feb 10, 2014
I have 4 small applets on a page that simply prints out the quadratic equation for values passed in. There are 4 applets on a page that have different values assigned. They display fine.... sometimes.... if I refresh or generate new numbers sometimes one applet looks as though it has numbers overlapping the new values. If I resize or drag the browser everything displays fine again - no need to refresh the browser or anything. It's as though old values or something are being overwritten by the new or something similar is happening. What should I include in the paint method of the JPanel that might clear the applet before initial painting happens..... if anything?
View Replies
View Related
Apr 1, 2014
I have in my app a JTable. I would like to know how can i do to, when i click in a cell, my jtable paint the entire line of this cell. Here is what i did.
Method call:
private void jTable1MouseClicked(java.awt.event.MouseEvent evt) {
int row = jTable1.rowAtPoint( evt.getPoint() );// Don't know how to send this info through setDefaultRenderer.
jTable1.setDefaultRenderer( Object.class, new RowRender() );
[Code] ....
View Replies
View Related
Feb 12, 2015
public void actionPerformed(ActionEvent e)
{
myBuffer.setColor(BACKGROUND);
myBuffer.fillRect(0, 0, WIDTH, HEIGHT);
myBuffer.setColor(Color.red);
for(int x = 17; x < WIDTH; x += 30) //vertical lines
[Code] ....
View Replies
View Related
Aug 11, 2014
I keep hearing these two term when it comes to painting in Swing, however, I'm not sure which is which. To my understanding is that the child components are the ones that already exist on screen (could be a JButton, JFrame, or custom painting) . and the parent components are the one to be added/drawn next. (hence, if we override the paintChildren() method when painting, the components that were already on the screen don't appear any more) ....
View Replies
View Related
Apr 17, 2014
Pretty much the title. Everything was running fine until a moment, when pain updated only once after the first resize. I've seen some worries about th.start(); or repaint(); but I did not manage to track the problem down since I'm a rookie at programming. Here's the Main class.
import java.applet.*;
import java.awt.*;
public class Main extends Applet implements Runnable
{
// variables
Thread th;
Player player;
static Shot [] shots;
[Code] ....
View Replies
View Related
Dec 30, 2014
I'm having trouble compiling this program. It is supposed to compute the average of the sum:
import java.util.Scanner;
public class ComputeAverage
{
public static void main(String[] args) {
Scanner bucky = new Scanner(System.in);
double fnum;
double snum;
[Code] ......
View Replies
View Related
Apr 1, 2014
I am working on a chess game. I need to construct a game room where all the player are present and room chat is up. Also some tables where games are being played. Now my question is how to create this game room?
To me this room must need to be like static or global (if I am not mistaken) that is up when server starts and players can join this room and should be down when server is done. How can I implement such room that would stay up for infinite time.
View Replies
View Related
Oct 24, 2014
Part 1: USING A WHILE OR A DO-WHILE LOOP write a program to compute PI using the following equation:
PI = 3 + 4/(2*3*4) - 4/(4*5*6) + 4/(6*7*8) - 4/(8*9*10) + ...
Allow the user to specify the number of terms (5 terms are shown) to use in the computation. Each time around the loop only one extra term should be added to the estimate for PI.
Alter your solution from part one so that the user is allowed to specify the precision required between 1 and 8 digits (i.e. the number of digits which are correct; e.g. to 5 digits PI is 3.14159), rather than the number of terms. The condition on the loop should be altered so that it continues until the required precision is obtained. Note that you need only submit this second version of the program (assuming you have it working).
My output for part 1 is :
Enter number of wanted terms for value of PI
100
PI = 3.1666666666666665 Number of Term = 2
PI = 3.1333333333333333 Number of Term = 3
PI = 3.145238095238095 Number of Term = 4
PI = 3.1396825396825396 Number of Term = 5
PI = 3.1427128427128426 Number of Term = 6
PI = 3.1408813408813407 Number of Term = 7
PI = 3.142071817071817 Number of Term = 8
PI = 3.1412548236077646 Number of Term = 9
PI = 3.141839618929402 Number of Term = 10 ................ and so on
I know you have to compare value of current Pi to the previous one but I'm stuck.
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
Nov 25, 2014
I'm new to Java and I want to write a program that compute all the possible arithmetic operations of 4 integers.
For example, if the user enter 1, 2, 3, and 4 respectively, then I want the computer to print out the following results:
1 + 2 + 3 + 4
1 + 2 + 3 - 4
1 + 2 + 3 * 4
1 + 2 + 3 / 4
..
1 / 2 / 3 / 4
(parenthesis can be ignored for this program)
This is what I have so far, but I don't know how to continue:
import java.util.Scanner;
public class ArithmeticComputation{
public static void main(String[] args) {
Scanner stdin = new Scanner(System.in);
int num1 = stdin.nextInt();
[Code] ....
I'm looking for a method that allows me to assign char into actual operators, so that I can loop through all the computation.
View Replies
View Related
Mar 27, 2014
import java.util.Scanner;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
public class logBook {
public static void main(String[] args) throws FileNotFoundException {
File inputFile = new File("C:UsersNick TateDesktopLog.txt");
[Code] .....
So far this is the code I have. It will successfully read the contents of the file(which are below in quotations) and write them to the designated file. My issue is totaling the corresponding costs to their services and then writing that to the file. The if and else if clauses above do not work but how is it that I can get them working?
"John; 67.00; Dinner ; Aug 12 2013;
Bob; 200.00; Conference; Sep 11 2013;
Clara; 450.00; Lodging; Oct 25 2013;
Jamie; 450.00; Lodging; Oct 28 2013;
Rachel; 67.00; Dinner; Nov 11 2013;
Richard; 200.00; Conference; Dec 17 2013;
Nick; 67.00; Dinner; Jan 05 2014;"
View Replies
View Related
Feb 13, 2015
This is what I need to do: Write a method called scientific that accepts two real numbers as parameters for a base and an exponent and computes the base times 10 to the exponent, as seen in scientific notation. For example, the call of scientific(6.23, 5.0) would return 623000.0 and the call of scientific(1.9, -2.0) would return 0.019.
This is the method I have written:
public double scientific(double num1, double num2); {
double base = num1;
double exp = num2;
double scientific = base * Math.pow(10, exp);
System.out.println(scientific);
return scientific;
}
These are the following error messages I received when trying to compile the code:
Line 4
missing method body, or declare abstract
missing method body, or declare abstract
public double scientific(double num1, double num2);
[Code] .....
How to fix each error?
View Replies
View Related
Nov 16, 2014
My verify method also always returns false. So I'm given three classes to begin with. Calculator, Expression, and InfixExpression and they are listed below.
The goal is to create a class called PostfixExpression that extends Expression and can read and calculate postfix expressions.
My evaluate() method works for most calculations but when it needs to return a negative value it just returns the positive equivalent.
Also, my verify method always returns false and I can't pinpoint why.
Here's my current code. Some things are commented out for debugging purposes.
import java.util.Scanner;
/**
* Simple calculator that reads infix expressions and evaluates them.
*/
public class Calculator
{
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
[Code] .....
View Replies
View Related
Sep 28, 2014
<import javax.swing.JOptionPane;
public class TempCalc {
public static void main(String[] args) {
//Confirming which conversion to compute.
String FarOrCel = (JOptionPane.showInputDialog("Would you like to calculate a Farenheit value or a Celsius value? (Enter Farenheit or Celsius)");
[Code] ....
So I've been trying to come up with a Farenheit to Celsius converter and back. However, whenever I run the program in JCreator it never recognizes the string "Farenheit". Even if I put that exact thing (I copy/pasted from the if (FarOrCel == "Farenheit")) it keeps asking me for a Celsius value.
[quote name='INNOCENTREAPER##!' date='28 September 2014 - 07:40 PM' timestamp='1411958437' post='2057072']
<import javax.swing.JOptionPane;
public class TempCalc {
public static void main(String[] args) {
//Confirming which conversion to compute.
String FarOrCel = JOptionPane.showInputDialog("Would you like to calculate a Farenheit value or a Celsius value? (Enter Farenheit or Celsius)";
[Code] ....
View Replies
View Related