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:

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


ADVERTISEMENT

Calculate Cost Of Ticket Order And Display Receipt For Customer On Screen

Oct 4, 2014

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

[Code] .....

View Replies View Related

Java GUI - Calculate And Display Total Cost For Certain Automotive Maintenance Services

May 12, 2014

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

[Code] .....

View Replies View Related

Basic Cost Calculator

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

Totaling Up Cost Of Service Categories

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

Get Certain Number Of Items And Then Calculate How Much Every Item Cost

Jan 4, 2015

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;
}
}

View Replies View Related

Writing A Pizza Program - Average Cost Of Order

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

Array List Of Pizza Toppings - Access Cost Through Get And Set Method?

Dec 1, 2014

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.

View Replies View Related

Get Input From User To Be Multiplied By Package Cost - Discounted Total?

May 12, 2014

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;

[Code] .....

View Replies View Related

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

Wages Calculator - Determine Total Cost Of Crew Departing From Port On That Day

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

Payroll Code - If Input Hours Greater Than 40 Cost To Employer Calculation Goes Wrong

Feb 28, 2014

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)

[Code] ....

View Replies View Related

Calculate Cost To Fill A Pool Based On Its Shape / Length / Width And Depth

Sep 17, 2014

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)

Formulas:
Rectangle cubic ft = length * width * depth.
Oblong cubic ft= ((Math.PI * Math.pow(width/2,2)* depth) +((length-width) * width * depth))
Gallons = cubic ft * 7.4805.
hours = total gallons/730.
Total cost = (total Gallons * .02)+(hours * $50)

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.

Here is my code:

import java.util.Scanner;
import java.util.*;
public class Pool
{
private String poolshape1 = "oblong";
private String poolshape1 = "rectangle";
private double length;
private double width;
private double depth;
private static double GallonsPerSqFoot = 7.4805;

[Code] .....

View Replies View Related

Calculate Fuel Economy Of Personal Car In Terms Of Gallons Per Mile And Total Cost For One Fill-up

Apr 4, 2015

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.

View Replies View Related

Int On JTable - Display Primitive Data Types

Jun 5, 2014

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...

View Replies View Related

Java Program - Display Up To 5 Pairings Of Data Types

Sep 7, 2014

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.

View Replies View Related

How To Display Table From Servlet To JSP

Oct 20, 2014

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 .

Sucess.jsp
-----------
<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<%@page import="StudentBean"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"/>/"+request.getServerName()+":"+request.getServerPort()+path+"/";

[code].....

note The full stack trace of the root cause is available in the Apache Tomcat/7.0.47 logs.

Apache Tomcat/7.0.47

View Replies View Related

How To Get A Text File To Display In A Table

Jul 10, 2014

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);

[Code]...

View Replies View Related

JSF :: How To Display Data In A Table Dynamically

Feb 15, 2014

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.

View Replies View Related

Truth Table - Display 1s And 0s Instead Of True False

Feb 26, 2005

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 +" ");

[Code] ....

View Replies View Related

Display School Time Table On Screen

Feb 14, 2014

How to solve the following task:

Design a programto display the followingSchool Time Table on screen.

Capture.PNG

Yourprogram should use thefollowing named constants tocontrol theformat of the calendar display:

/*Thenumberofdaysinthemonth*/
privatestaticfinalintDAYS_IN_MONTH=31;
/*Thedayoftheweekonwhichthemonthstarts*/
/*(Monday=0,Tuesday=1,andsoon)*/
privatestaticfinalintDAY_WEEK_STARTS=0;
/*Thewidthinpixelsofadayonthecalendar*/
privatestaticfinalintDAY_WIDTH=40;
/*Theheightinpixelsofadayonthecalendar*/
privatestaticfinalintDAY_HEIGHT=30;

View Replies View Related

JSP / JSTL :: Bunch Of Db Data Need To Display Over Table

Feb 24, 2013

I am using eclipse 6.0 - structs 1.3my requirement is to simple. "bunch of db data need to display over the table". I need an example.

View Replies View Related

Swing/AWT/SWT :: Refreshing GUI - Display Table With Several Columns And Rows

Jun 6, 2014

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?

View Replies View Related

JSP :: Extract PDF From Folder And Display Them In Html Table In Browser

Jan 31, 2014

I have folder which contains PDF and i want to show them in html table in the web browser using JSP

View Replies View Related

JSP / JSTL :: Display Data From One Or More Table - Left Navigation Page

Dec 14, 2012

I am new to JSP . I am Using Jdeveloper UDI to create JSP Pages.

My main idea in creating JSP to display data from one or more tables.

I created 2 pages called Serverpage.jsp and Messagecount.jsp and it is working fine as expected,

Now i want to create home page and it should also have left navigation menu and it should contain MessageCount and MessageStatus.

When i click on Messagecount or MessageStatus my home page should refresh and have to display new JSP page (MessageCount.jsp or Serverpage.jsp)

Here is my JSP pages

Serverpage.jsp

<%@ page contentType="text/html;charset=windows-1252" isELIgnored="true"%>
<!--<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>-->
<html>
<head>
  <title>Welcome to Monitoring Page!</title>
  <link type="text/css" rel="stylesheet" href="jdeveloper.css"/>
  <script language="javascript" type="text/javascript" src="Calender.js">

[Code] ....

View Replies View Related

Adding And Subtracting In Budget Program - Display Table Showing Transactions

Mar 15, 2014

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)

//add button clicked
private class BtnAddActionListener implements ActionListener {
public void actionPerformed(ActionEvent arg0) {
((DefaultTableModel)table.getModel()).addRow(new Object[]{
cbMonth.getSelectedItem() + "/" + txtDay.getText() + "/" + cbYear.getSelectedItem(),
cbCategory.getSelectedItem(),

[Code] .....

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.

View Replies View Related







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