Hello guys! I am going to keep doing this lol.
Assignment!
You are planning a pizza party want to order exactly the number of slices of pizzas and drinks. Each pizza has 10 slices. A pizza costs $10.50 per pizza or $1.25 a slice and a drink costs $.90 per drink. After a survey, you determined that each attendee will eat 4 slices of pizza and drink 2 drinks. There will be a tax of 9.5% added to your total. Write a program that will calculate the total cost of your pizza party. The program will perform the following tasks:
•Ask and accept the user’s number of attendees.
•Calculate the number of whole pizzas and extra slices of pizzas as well as the number of drinks.
•Calculate the cost of the pizzas (whole pizza plus extra slices), drinks, salestax, and total due.
•Display to the monitor the number of attendees, number of whole pizzas, additional slices, cost of the pizzas, the number of drinks and cost of drinks,tax due, and total due.
•Use integer data types for the number of attendees, number of pizzas, number of slices, and number of drinks.
•Use double data types for cost of pizzas, cost of drinks, tax, total due.
•Use constant double for the price of the whole pizzas, price per slice, price of drinks, and tax rate.
•Please note that output of all costs will not be formatted. For example, 20.50 may be displayed as 20.5 or a tax due may be 1.9474 is also acceptable.
Assignment 4 will require output formatting.
I am not asking someone to do this for me! I am asking for help and as I post my code give me tips and pointers and let me know if you see anything wrong. Thanks for everything guys!
Code:
import java.util.Scanner;
/*Andrew Varnick
9/12/2013
CSCI 1015
Programming Assignment 3
*/
public class VarnickPass3
{
public static void main(String[] args)
{
Scanner keyboard = new Scanner(System.in);
final double CostWholePizza, CostPizzaSlice, CostDrink, TaxRate;
double WholePizza, Drinks, Tax, Total;
int NumberAttendees, NumberOfWholePizza, NumberOfPizzaSlice, NumberOfDrinks;
int x, y;
String Number_Attendees;
//Constants
System.out.println("Loading Constants....");
CostWholePizza = 10.50;
CostPizzaSlice = 1.25;
CostDrink = .90;
TaxRate = 0.095;
//Gets the number of people attending
System.out.println("Done loading constans!");
System.out.println("Please enter the number of attendees");
Number_Attendees =
keyboard.nextLine();
//Converts number of people from a string to an int
NumberAttendees = Integer.parseInt(Number_Attendees);
//Math
x = NumberAttendees * 4;
System.out.print("Total number of whole pizzas is:" + x);
System.exit(0);
}
}