please help asappppppp Available Aug 16 at 12am-Sep 17 at 5pm about 1 month Disc
ID: 3742775 • Letter: P
Question
please help asappppppp
Available Aug 16 at 12am-Sep 17 at 5pm about 1 month Discussions Grades Syllabus Modules People Chat Google Drive Collaborations Course Bug Re- Pizza Party This Project Challenge is a graded assessment. You should collaborate with another student to solve this problem. Both students will receive the same score for this assessment In groups of 2(or 3)-Using the Vocareum environment, solve the given problem. Problem Description and Give Info Inputs . Number of pizzas purchased . Number of slices per pizza . Number of adults . Number of childrern Outputs port . Number of slices each child will get . Number of slices left over 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 When you have finished, be sure to upload a copy of your code for this assignment. Be sure to type the full name of each member of your group in the Comments box before you click Submit.Explanation / Answer
import java.util.Scanner;
public class PizzaParty {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("Number of pizzas purchased: ");
int no_pizza = scanner.nextInt();
System.out.println("Number of slices per pizza: ");
int no_slice = scanner.nextInt();
System.out.println("Number of adults: ");
int no_adults = scanner.nextInt();
System.out.println("Number of children: ");
int no_children = scanner.nextInt();
int total_slices = no_pizza * no_slice;
int slices_for_children = total_slices - no_adults * 2;
int slices_per_child = slices_for_children / no_children;
int slices_remain = slices_for_children % no_children;
System.out.println("Number of slices each child will get: " + slices_per_child);
System.out.println("Number of slices left over: " + slices_remain);
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.