Display Two Types Of Table One With Initial Cost And Another With New Cost
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:
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
Write a program that will calculate the cost of a ticket order and display the receipt for the customer on the screen. There are 2 ticket prices: adult, and senior citizen. Adult seats are $4.50 and senior citizen seats are $3.50. If more than 5 senior citizen tickets are purchased, the customer gets an extra 20% off the of the ticket order. If more than 10 regular seats are purchased, the customer gets an additional 10% off the cost of the order. A customer can only place an order for one type of ticket. Output the type of ticket purchased, the number of tickets purchased, the gross cost, the amount of the discount, and the final cost of the order.
I am having errors with incaompatible varriables comparing float with doubles.
public class lab3 { static Library myLib; public static void main (String [] args) { Library myLib = new Library(); //Instance the Library class int ticketNum; //Number of Tickets
I'm trying to create a GUI application that calculates and displays the total cost for certain automotive maintenance services. The application should contain hree classes: 1) the main class that creates and displays the window; 2) a panel for the routine services and 3) a panel for the non-routine services. 2 and 3 are instantiated in 1. I'm pretty positive the error lies in the NonRoutinePanel class because when I comment it out of the main class the program runs fine. But I can't quite figure out which lines of code or methods are causing the problem.
When I try running the program I get these error messages:
Exception in thread "main" java.lang.NullPointerException at java.awt.Container.addImpl(Container.java:1040) at java.awt.Container.add(Container.java:958) at javax.swing.JFrame.addImpl(JFrame.java:540) at java.awt.Container.add(Container.java:926) at JoesAutomotiveGUI.<init>(JoesAutomotiveGUI.java:38) at JoesAutomotiveGUI.main(JoesAutomotiveGUI.java:111)
Here's my code for the three classes:
import javax.swing.*; // Needed for Swing class import java.awt.*; // Needed for BorderLayout class public class RoutineMaintenancePanel extends JPanel { public final double oilChange = 26.00;// cost of oil change public final double lubeJob = 18.00;// cost of lube job
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?");
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;"
This is supposed to get a certain number of items, and then calculate how much every item costs. It adds up the sum of those prices and checks if it is over 150$, if it is, it returns true, if it's not, it returns false.
import java.util.*; class Cust { public static boolean DelPay (int a) { Scanner reader=new Scanner (System.in); int b,s=0; for (int i=1;i<=a;i++) { b=reader.nextInt(); s=s+b; } if (s>150) return true; return false; } }
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;
So I have created a array list of pizza toppings, only 4 in total, and each ingredient needs to have a cost property. I'm supposed to access the cost through a get / set method, as the user can create their own pizza and it will total up the cost, but how to.
I am new to java and this is one of my first program assignments. I can't figure out how to make the if else statements work. I am trying to get the input from the user to be multiplied by the package cost but it gives me an error. I also can't figure out how to solve for the discounted total.
Purpose of the program: To write a program that asks the user to enter the number of packages purchased. The program should then display the amount without any discount, the amount of the calculated discount (if any), and the total amount of the purchase after the discount is applied.
What the output should be:
Enter the number of packages purchased: 10 Your total without discount: $990.00 The discount is: $198.00 The discounted total: $792.00
import java.util.Scanner; public class Practice { public static void main(String[] args) { double packageCost = 99.00; double amtPackage = 10.00; double withoutDiscount = packageCost * (double) amtPackage;
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.
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:
I think I fixed the first error, but now I'm receiving another error in my Net Pay print statement at the end.
Here is what I'm supposed to receive:
Net Pay: 599.86
Here is my sample run:
run-single: Enter hourly rate in dollars and cents --> 27.16 Enter number of hours and tenths worked --> 37.9
PAYROLL REPORT Rate: 27.16 Hours: 37.9
Gross Pay: 1029.36 Federal Tax: 257.34 State Tax: 93.41 FICA: 78.75 Net Pay: 771.86
Employer's FICA contribution: 78.75 Employer's UEI and DI contribution: 20.59 Cost to Employer: 1128.70
Enter hourly rate in dollars and cents -->
Here is my updated code:
package assignmentproject1; /* CHANGE (FINAL) VAR NAMES, SCAN & VERIFY, ORGANIZE AND PUT FORMULAS ON BOTTOM, ORGANIZE VAR @ TOP, */ import java.util.*; public class Project1 { public static void main (String[] args)
This program is for a swimming pool filling service company. They charge 2 cents per gallon and $50 per hour to fill a pool. The truck can fill at a rate of 730 gallons per hour.
Create the Pool class that calculates the cost to fill a pool based on it's Shape, length, width and depth. (Input order is S L W D)
The pool class will need data fields for String shape, double length, double width, double depth, static double GallonsPerSqFoot = 7.4805, static double price per gallon = .02, static double FillingFeePerHour = 50.0, and static double FillingRate = 730gal/hr.
Create a No-Arg constructor and a constructor that accepts the non-static values, and has the methods: getShape, getLength, getWidth, getDepth, getGallons, getHours, getFillingFeePerHour, getHourlyCost and getTotalCost.
At the end of the class, create a main() method that asks for the input and returns the output based on the Pool class gets.. methods.
The shape options are oblong or rectangle. (A round pool would be oblong with the same width and height, a square pool would have the same width and height)
Example Output An oblong pool 18.00 feet long by 12.00 feet wide and 5.00 feet deep will use 6923.10 gallons of water and take 9.48 hours to fill. The total cost will be 612.65.
public class CarV5 { // private instance variables String Model1; int endMiles1, startMiles1; double gallonsUsed1, pricePerGallon1;
[Code] .....
When I try to compile the program, its telling me that it cannot find the Dist variable in the main method for calcMPG and calcGPM. I'm not sure if the methods are right for the calcGPM or calcMPG.
I have an int array that has information read from a file. Now i want to display this int on a jtable but ofcourse i cant display primitive data types.. and also you cannot cast an int[] to an Object[], so I am stuck...
I need to write a simple program that displays up to 5 pairings of data types (int, string) (string, long) ect. I need to have at least two classes, a Pair class (generic) and an PairTest class.
When I am entering the student name , his/her details should be retrieved from database by servlets and the data to be print in jsp pages this what I want But I am unable to display the data from database in jsp pages .
I think I need to save the file into an object but I cannot seem to figure out how. I tried to save it into a string array but that did not work either. I have been working on that section for three weeks and cannot get it to display correctly.
public class DVDList2 { private static void CreateGUI(){ File file = new File("C:UsersaprildesktopDVD.txt"); JTextField txtName, txtSeason, txtSearch, txtMain; JFrame frame = new JFrame("DVD List"); txtName = new JTextField(20);
Need to display data in a table - no of columns are fixed, and rows may vary based on the data available in DB.Display tables in horizontally and 2 tables per row. If it exceeds 3 it should display in next rowsample format to display attached in attachment,Using JSF 2 & richfaces 4.0.
I'm supposed to take this truth table and alter it so it displays 1's and 0's instead of true false. I'm assumed to do this I would just need to change the variable type and replace true and false with 1 and 0 but every way I try this does not work.
//a truth table for the logical operators.
class LogicalOpTable { public static void main(String args[]) { boolean p, q; System.out.println("P Q AND OR XOR NOT"); p = true; q = true; System.out.print(p + " " + q +" ");
I have an application that displays a GUI and this GUI displays a table with several columns and rows. I have a class that extends DefaultTableModel. I wrote the code that displays the GUI. When the database table changes, how would I updated the GUI dynamically? Do you have any sample code that does that?
Budget program. Here is my situation, I have 2 tabs in a GUI, one tab adds a transactions when the add button is clicked, and in the other tab displays a table showing all the transactions. In my code, I want it so that when the user chooses a deposit(combo box variable name = cbType, indexnumber for deposit is 0) it will add to the total and when the user chooses withdraw(index number is 1) then it will subtract it from the total. Here is the code.... (note as well, the code also adds a new row to the table)
So when I tested the program with 2 transactions, the first transaction was a deposit and the 2nd transaction was a withdraw. The end product was that both amounts were subtracted from the total. When I did a withdraw first and a deposit second, the amounts were both added together.