Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

Assignment 1 - Pizza Party CSE 110 Principles of Programming with Java Spring 2021 Due February 7th 2021, 11:59PM Arizona Time 1 Assignment Objectives & Requirements 1.1 Assignment Objectives After...

1 answer below »
Assignment 1 - Pizza Party
CSE 110 Principles of Programming with Java
Spring 2021
Due Fe
uary 7th 2021, 11:59PM Arizona Time
1 Assignment Objectives & Requirements
1.1 Assignment Objectives
After completing this assignment the student should be able to:
• Write, compile, and run a small Java program
• Use System.out to display prompts and other information to the use
• Collect input using a Scanner object
• Declare and use variables
• Use math operators and expressions to compute desired values
1.2 Assignment Requirements
For this assignment you are given the following file -
Assignment01.java (you must complete this file).
2 Problem Description and Given Information
Within the main() method in the Assignment01.java file, you must write a program to determine how to split a
number of pizzas (each with the same number of slices) among a group of adults and children at a pizza party.
Your program must prompt the user to enter the four integer input values described below. It must collect the user’s
input and store these values in four different variables. It must collect the inputs in the order shown below. You
program must compute the five integer output values described below. It must store these output values in five
different variables. It must print out the five output values. The output must be formatted exactly like the Expected
Outputs examples shown below.
Inputs
1. Number of pizzas purchased
2. Number of slices per pizza
3. Number of adults
4. Number of children
Outputs
1. Total number of slices of pizza
2. Total number of slices that will be given to the adults
3. Total number of slices available for the children
4. Number of slices each child will get
5. Number of slices left ove
Other Details
• Each adult will get two slices of pizza
• Remaining slices will be divided evenly among the children
• Each child will get the same number of slices of pizza
• No pizza slices will be split or divided
• Make sure that your program displays 5 lines of output that look like these:
Total number of slices of pizza : 8
Total number of slices given to adults : 2
Total number of slices available for children : 6
Number of slices each child will get : 6
Number of slices left over : 0
1
2.1 Test Data
Use the following test cases to check if your program is co
ect.
Test Case 1:
Given Input
Number of pizzas purchased : 1
Number of slices per pizza : 8
Number of adults : 1
Number of children : 1
Expected Output
Total number of slices of pizza : 8
Total number of slices given to adults : 2
Total number of slices available for children : 6
Number of slices each child will get : 6
Number of slices left over : 0
Test Case 2:
Given Input
Number of pizzas purchased : 2
Number of slices per pizza : 8
Number of adults : 2
Number of children : 3
Expected Output
Total number of slices of pizza : 16
Total number of slices given to adults : 4
Total number of slices available for children : 12
Number of slices each child will get : 4
Number of slices left over : 0
Test Case 3:
Given Input
Number of pizzas purchased : 2
Number of slices per pizza : 10
Number of adults : 3
Number of children : 8
Expected Output
Total number of slices of pizza : 20
Total number of slices given to adults : 6
Total number of slices available for children : 14
Number of slices each child will get : 1
Number of slices left over : 6
3 To Do
After reading the problem description, you may follow the given steps to starting your assignment -
1. Create a new project in your IDE called Assignment1
2. Create a new source file called Assignment1.java inside the project
3. Copy the contents of the source file provided for this assignment into the one created by you
4. Follow the comment sections along with the requirements listed in section 2 to complete your code
5. Compile and run your program to check for e
ors
6. Use the test case input values given section 3 and check if you are getting the same outputs for each test case
7. Make sure you submit your source code file Assignment1.java to the submission link by the deadline
4 Submission Guidelines
Please follow the guidelines listed below prior to submitting your source code file Assignment.java on Canvas -
1. Make sure that your source code file is named Assigment1.java prior to submitting.
2. Make sure that your input and output matches the format shown in the test cases
3. Make sure that you have completed the comment section at the top of the source code file
4. Submit your Assignment1.java file only to the Canvas link for Assignment 1 by Fe
uary 7th 2021,
11:59PM Arizona Time.
2
5 Grading Ru
ic
Criteria Points
All required files are submitted 10
Each file includes the comment head section completed.
Code is neat and well organized 10
Good naming conventions for all identifiers
Good use of whitespace
Descriptive comments
Partial credit can be awarded
Code compiles with no syntax e
ors 20
No Partial credit can be awarded
No credit will be awarded for structure or logic if your code does not compile
Code passes structure tests 30
Code collects 4 required inputs
Code computes and stores 5 values
Code outputs 5 results
10
10
10
Code passes logic tests 30
Partial credit is awarded based on number of tests passed
No credit will be awarded for logic if your code does not pass all structure tests
See test examples (#1 - #3) above in these instructions
TOTAL 100
3
    Assignment Objectives & Requirements
    Assignment Objectives
    Assignment Requirements
    Problem Description and Given Information
    Test Data
    To Do
    Submission Guidelines
    Grading Ru
ic
Answered Same Day Feb 06, 2021

Solution

Neha answered on Feb 07 2021
136 Votes
import java.util.Scanner;
public class Assignment1
{
    public static void main(String[] args) {
     int pizza, slice, adult, children;
     int numberOfSlices,adultShare,totalForChildren, childShare,leftOver;
        Scanner input = new Scanner(System.in);
System.out.println("Number of pizzas purchased");
pizza = input.nextInt();
...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here