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


ADVERTISEMENT

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

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

Pizza Pickup And Delivery Ordering Java Program

Jul 31, 2014

This is my code for a Pizza Pickup and delivery I am am having a few issues.

public class Internal {
public static void main(String[]args) {
double total2 = 0;
String customerName = " ";
String address = " ";
String phoneNum ="0";

[Code] ....

View Replies View Related

Pizza Program For Java / Resetting Prices Does Not Function

Jul 26, 2014

I am making a pizza program and most of the program works. I have made an order button that will output the total price of the order. The reset button that I made makes the JTextArea output $0.00, but if I press the order button to make another order, the program does not add the new amount to zero. For example, if I make an order that totals $5.00, but I want to make another order after resetting, the price for the new order will be added on to the previous order's price.

Here is the code. This is a JApplet program. Why the price will not reset? This code was made in BlueJ.

//Author:Kishan Patel
// Sources will be cited soon.
//This is Lab 7, the pizza parlour program.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.io.*;
import java.util.*;

[code]....

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

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

GPA And Average Program

Mar 25, 2014

I am new on this and I will be working in a gpa and average program. This is my code so far: Every time that I try to add the gpa part it gives me errors or just duplicates whatever I've in average and displays it in gpa

/**
* This program shows a database of students in a school.
* It gathers information as name, classes, grades, and calculates average and gpa average.
*
*/
import javax.swing.JOptionPane;
 
[code]....

View Replies View Related

Program That Has Weighted Average Code

Sep 28, 2014

I am doing a program that has a weighted average calculation and everything compiles and runs. It is just that my weighted average seems to be calculating incorrectly.This is the type of output I should see:

Homework:
Number of assignments? 3
Assignment 1 score and max? 14 15
Assignment 2 score and max? 16 20
Assignment 3 score and max? 19 25
Sections attended? 4
Total points = 65 / 80
Weighted score = 40.63
Exam 1:
Score? 81
Curve? 0
Total points = 81 / 100
Weighted score = 16.2
Exam 2:
Score? 95
Curve? 10
Total points = 100 / 100
Weighted score = 30.0
Course grade = 86.83

Below is my code and I think even after getting up this morning and looking at it, I have an error in the calculations, but I can;t pinpoint it.This program is supposed to receive input from user, and calculated the grades of a student with a weighted average
 
import java.util.Scanner;
public class Grades{
private double weightExam;
private double score;
private double curveAmount;
private double scoreTotal;

[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

Student Grade Average Program?

Mar 27, 2015

I just have not got the chance to spend much time on it lately I know a bit but I'm not an expert or even intermediate with Java so I'm trying to make a program where the teacher enters the grade of each student and its stored in a variable the only problem is if I use a for loop the variable in which the result will be stired will be overwrite by the last repetition of the loop,I think the idea would be a nested loop but how I would go about using it in this situation,

here is my java code.

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

[Code].....

View Replies View Related

Average Program - Number Format

May 5, 2015

I am writing a program using a given test drive... I am supposed to write two classes according to the test drive. The calculated correct answer should be 115.50 but i keep getting 115.52 instead and i just can't figure out what i'm doing wrong.

Here is the test drive code:

import java.text.NumberFormat;
public class FinalTester
{
public static void main(String[] args)
{
double avgPurchase;
Order[] lastYear = new Order[4];

[Code] ....

View Replies View Related

How To Write A Program Which Compensate Average

Jan 12, 2015

I have a question. How to write a progamme which compensates an average if it is less than a 10/20. I use eclipse and database HSQLDB. I have a table with notes. After the compensates, I must change the note in my database.

I have three notes

12, 11, 5

The average is 12+11+5/3=9,33

I take the lowest note: 5

12+11+x/3 = 10

12+11+x/3 = 30/3

x=30-23

x=7

The new average is 12+11+7/3=10

View Replies View Related

Writing A Calculation For A Program?

Sep 8, 2014

I am writing a program in Java where a user adds 1 stamp on a letter for every five sheets of paper in it (or fraction thereof)For example, I if I have 11 sheets of paper, I add 3 stamps. If the total number of stamps is more than 3, they don't send it.

I need to ask the user how many sheets of paper they have, and then calculate the appropriate number of stamps based on the formula above. I just don't know how to write the math formula to calculate this, i'm stuck. So far I have:

package test;
import java.util.Scanner;
public class LetterMailing {
public static void main(String[] args) {
Scanner stdIn = new Scanner(System.in);
int numSheets;

[Code] .....

What should I do next?

View Replies View Related

Test Score Average Program In Java

Jun 16, 2014

I'm working on a homework assignment and I keep getting a compiler message this is the message

GradesAverage.java:44: error: variable totalgrade might not have been initialized
System.out.println("Over all you have " + totalgrade);
^
1 error

The homework is this Write a program that has variables to hold three test scores. The program should ask the user to enter three test scores and then assign the values entered to the variables. The program should display the average of the test stores and the letter grade that is assigned for the test score average. Use the grading scheme in the following table:

Test Score Average Letter Grade
90-100 A
80-89 B
70-79 C
60-69 D
Below 60 F

This is my code

import javax.swing.JOptionPane; // Needed for JOptionPane class
import java.util.Scanner; // Needed for the scanner class
public class GradesAverage
{
public static void main (String[] args)

[code]....

View Replies View Related

Trying To Create A Program That Provides Average Test Scores

Apr 13, 2014

I keep getting an error that says variable can't be found, what am I missing?

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.text.DecimalFormat;
import java.util.Scanner;
public class testscores extends JFrame

[code]...

View Replies View Related

Writing A Java Program To PRINT?

Oct 19, 2014

how to print from bluej onto actual paper? how to do the formatting and configuration etc.

View Replies View Related

Writing A Program To Take Input From User?

Oct 23, 2014

Writing a program to take input from user. This input must be done with numbers only. If the input is a string I would like the program to loop and ask for input again.

double depositCheckingAmount;
do
{
System.out.println("Please insert amount to deposit into checking.");

[Code]....

As you can see my attempt is to use the ! expresssion incase the input does not equal a double. Is there another method I should be using?

View Replies View Related

Average Program - Divisible Numbers Not Calculating Correctly

May 21, 2015

For some reason, the averages aren't calculating correctly. I'm aware I need to convert to double if I'm dividing by an odd amount but that itself isn't the issue. It's just simple easy divisible numbers that are not being calculated correctly. For instance, (10 + 10 + 10 + 50) / 4 = should be 2 but I get 10.

Here is the code:

import java.util.Scanner;
public class Avg {
public static void main(String[] args){
Scanner inputGains = new Scanner(System.in);
int userInput = inputGains.nextInt();

[Code] ....

View Replies View Related

Create A Program That Shows Three Test Grades And Average

Jan 28, 2015

package Program1;
import java.util.Scanner;
public class Source1 {

[Code].....

using netbeans to debug the program but i'm not sure what I did wrong as it doesnt go past test 1

View Replies View Related

Parallel Program - Calculate SUM And AVERAGE Of Odd Number Digits Between 25 And 75

Jun 11, 2014

You are to write a parallel program that will receive a large array of unsorted integers containing digits from 0 to 99. The program will have to calculate the SUM and AVERAGE of ODD number digits between 25 and 75 (inclusive). The user may specify the size or the array and the total processor that the machine has. The size of the array must be divisible by number of processor. Based on the given size, the computer will generate random integer numbers automatically to populate the array.

The program should display the status of the calculation for each processor. The result should be displayed after all calculations are completed.Error messages should be displayed appropriately

a) Write a sequential (non-parallel) program that will accomplish above task.
b) Write a concurrent (parallel) program that will produce the result of the above task.

View Replies View Related

Grade Average Program - Hit Button Reseved For Calculations

Nov 23, 2014

I have written a simple grade average program. This is my code:

package programs;
 import java.util.Scanner;
 public class GradeAverage {
 public static void main(String[] args) {
 Scanner input = new Scanner(System.in);
int number;
int counter = 0;
int grade;
 
[Code] ....

Now the program is working just fine but what I don't like about it is the fact that you have to enter the number of grades before entering the grades. What I would prefer is to write your grades, hit some button that is reserved for calculating the average and then get the output.

View Replies View Related

Add Program In Order To Dice To Roll

May 8, 2014

what code I should add to my program in order to get these dice to roll. The program, according to my teacher, is CORRECT so far, so I'm not going to change anything. I just need to know how to roll the 2 dice I added in. I just want to get it done. No math.Random. The direction is: Roll each of the Dice by invoking the roll method on each Dice in the array.

My code:

//Dice.java
package homework3;
import java.util.Random;
public class Dice {
private int numberShowing;
private int numberOfSides;
private static final Random randomNumber = new Random();

[code]....

View Replies View Related

Writing A Program For System Of Linear Equations

Sep 22, 2013

So i was assigned to write a program that would print the answer to the system of two linear equation. the form of ax+by=c and dx+ey=f..I wrote this program, but it is incorrect since I tried it out on my terminal and I keep getting incorrect values.

import java.util.Scanner;
public class Quest4 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);

[code]....

View Replies View Related

Writing A Program To Dynamically Update XML File To Add

Feb 8, 2014

I'm writing a program to dynamically update an xml file to add, delete, and edit entries in the file. I've run into an issue with the add method because when I write into the file, a random letter is added before the line. EX:

I want to add "<item> ..." to the end of the list of entries, but when it is added, this is what is added "Z <item> ..."The spacing for the <item> is correct, however, I don't see where or why the Z is added.

public static void insertItem(Item i)
{
try {
String insert = " <item>";
String text = "";
Scanner in = new Scanner(file);

[code]....

View Replies View Related

Writing A Program To Search Bluetooth Devices

May 2, 2014

Im trying to write a java program to search nearby bluetooth devices.. Im using Bluecove-glp-2.1.0 and bluecove 2.1.0..Im working on Ubuntu 13.04 LTS.I typend a code to get the local Device name..

public class BluetoothSearch {
public static void main(String[] args) {
LocalDevice ld= null ;
String name = ld.getBluetoothAddress();
System.out.print(name);
}
}

this is my code.. It returns me null. doesn't return me the local Device.

View Replies View Related







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