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


ADVERTISEMENT

Totaling Up Costs Of Corresponding Service Categories From A File

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

[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

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 View Related

Web Services :: Difference Between Web-service And Service Operation?

Feb 24, 2015

difference between webservice and service operation.

View Replies View Related

Totaling Up Costs Of Services From Read In File

Mar 27, 2014

Java Code:

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

[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

Adding (totaling / Summing) Two Values In Java JTable

Nov 11, 2014

I want to use JTable in which the user can enter the obtained marks of students and automatically add (total) the obtained marks in the total column. The structure of the table is given below.

S.No Name Test1 Test2 Total

View Replies View Related

Exam Results - Code Should Split Results In Stars In 4 Categories

Nov 30, 2014

I'm doing a program where a user enters in exam results for students. Once he's entered the code, the code should split the results in stars in 4 categories.

I am working with a while loop that prints out infinite results. What I want to do is, if the user enters 2 digits, say "12", it should output 1 "*".

If the user enters "21" and "22", it should output "**".

There are 4 categories of marks which are marked with ints range1, range2, range3 and range4, which are user enter digits. Part 1 of the code is to split the user entered digits into its correct ranges. the ranges are 0-29, 30-39, 40-69 and 70-100. I've done the part where when the user enters a digit, it goes into the correct variable. After that when the user enters a digit over 100, the enter results should show up as stars. For example

Enter number =

21
22
44
66
44
23
11
111 (the 111 is where the program breaks and moves on)

So it should then display

0-29 ****

30-39

40-69 ***

70-100

Whatever I'm trying, it displays an infinite amount of stars. If I try to use break, It only outputs a single star, no matter how many digits I enter

Here is the code

int mark = 0;
int range1 = 0, range2 = 0, range3 = 0, range4 = 0;
int count1 = 0, count2 = 0, count3 = 0, count4 = 0;
while (mark >=0 && mark <=100) {

[Code] .....

"The problem is with the while loop, the one above is something I was experimenting with "

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

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

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

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

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

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

Creating A Web Service

Jul 23, 2014

I'm new to Web Services and I've been finding trouble when creating my first one. Before talking about the problem, I'd like to show you the process I followed to see if it's ok. Note that I'm using Eclipse Kepler, Tomcat 5.5 and Axis2.

1- I created a new Dynamic Web Project.

2- I created the Java class that implements the service with just one method, a simple one: you pass it a name and it returns "Hi, <name>"

3- Right click over that class and then: Web Services -> Create Web Service

4- I go through the next steps. On the last one, I select "Launch the Web Services Explorer to publish this Web service to a UDDI Registry". Click on "Finish".

5- The Web Services Explorer is launched, but I just get a "HTTP ERROR: 500" message.

I understand that my Web Service wasn't published and therefore it's useless to create a client as it wouldn't connect.

View Replies View Related

Sending XML To PHP Service Via POST

Jul 7, 2014

I have a server with a handful of php services. I communicate with these services by creating connections from java code. The services currently respond with XML, but that can be changed if an alternative way can improve performance.

One of the things I need to do is send varying sized payload (some large) to one of the services. My current plan is to create an xml file in java and perform a POST request with the XML as the payload. I am using an XML because the data is very structured.

From a performance point of view, would it be better to send the XML as a file or just as text? Also, is there a better way to send this data? These services will eventually be used by an android app, where performance and minimizing the size of the data packages will be extremely important.

View Replies View Related

How To Code XML Web Service To Java

Feb 4, 2014

How to call web service from xml to java. I'm just new in using Java.

View Replies View Related

JAX-WS - Process ID Of Web Service Request

Aug 22, 2014

I am using JAX-WS to develop web services.
 
I would like to know how i can find the process ID associated to a request.

View Replies View Related

Web Services :: Calling SOAP Web Service

Jan 24, 2015

I am new to web services and need to call a web service that has already been written. Below is the wsdl for the web service.I need to call the web service from my java program. provide the code to call the webservice?

<definitions targetNamespace="urnefaultNamespace">
<message name="CREATECONTACTUSResponse"></message>
<message name="CREATECONTACTUSRequest">
<part name="REQUESTTYPE" type="xsd:string"/>
<part name="SALESORG" type="xsd:string"/>
<part name="FIRSTNAME" type="xsd:string"/>
<part name="LASTNAME" type="xsd:string"/>
<part name="EMAILADDRESS" type="xsd:string"/>
<part name="TELEPHONENUMBER" type="xsd:string"/>
<part name="EXTENSION" type="xsd:string"/>

[code]....

View Replies View Related

How To Return XML File / String From Web Service

Nov 10, 2014

I have a web service which is returning a string. I want to extend this web service so that it returns an xml based string. To begin with I am able to return xml based strings from a normal POJO class ....

View Replies View Related

Client App To Consume Web Service With Security

Dec 15, 2014

I need to write a simple client to access a WS. Things I can not do :

Modify the serverAdd external jars 

The client will be part of a command line call and will run as a stand alone.
 
I've been searching all day and have found hundreds of vague, overly complex examples, mostly based on SOAPHandler (which tells me I need to install server components which I cannot do). I grasp the general requirements but am having difficulty figuring out how to add the security elements to the header.
 
What do I need to do to add the username and password tokens to the header?
 
This is where I am so far.

package findingLetter;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import javax.xml.namespace.QName;
import javax.xml.soap.MessageFactory;

[Code] ....

View Replies View Related







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