Program Specifications. Write a program to calculate the cost of hosting three pizza parties on Friday, Saturday and Sunday. Read from input the number of people attending, the average number of slices per person and the cost of one pizza. Dollar values are output with two decimals. For example, System.out.printf("Cost: $%.2f", cost);
Note: this program is designed for incremental development. Complete each step and submit for grading before starting the next step. Only a portion of tests pass after each step but confirm progress.
Step 1 (2 pts). Read from input the number of people (int), average slices per person (double) and cost of one pizza (double). Calculate the number of whole pizzas needed (8 slices per pizza). There will likely be leftovers for breakfast. Hint: Use the Math.ceil() method to round up to the nearest whole number and convert to an integer. Calculate and output the cost for all pizzas. Submit for grading to confirm 1 test passes.
Program Specifications Write a program to calculate the cost for replacing carpet for a single room. Carpet is priced by square foot. Total cost includes carpet, labor and sales tax. Dollar values are output with two decimals. For example, System.out.printf("Cost: $%.2f", cost);
Note: This program is designed for incremental development. Complete each step and submit for grading before starting the next step. Only a portion of tests pass after each step but confirm progress.
Step 1 (2 pts). Read from input the carpet price per square foot (double), room width (int) and room length (int). Calculate the room area in square feet. Calculate the carpet price based on square feet with an additional 20% for waste. Output square feet and carpet cost. Submit for grading to confirm 1 test passes.
A local pizza shop is selling a large pizza for $9.99. Given the number of pizzas to order as input, output the subtotal for the pizzas, and then output the total after applying a sales tax of 6%.
Output each floating-point value with two digits after the decimal point, which can be achieved as follows:
System.out.printf("Subtotal: %.2f\n", yourValue);
Ex: If the input is:
3the output is:
Subtotal: $29.97
Total due: $31.77We want to calculate the total marks of each student of a class in Physics, Chemistry and Mathematics and the average marks of the class. The number of students in the class are entered by the user. Create a class named Marks with data members for roll number, name and marks. Create three other classes inheriting the Marks class, namely Physics, Chemistry and Mathematics, which are used to define marks in individual subject of each student. Roll number of each student will be generated automatically.
Hey I’ve got this cool idea for an app! It’s kind of simple but just hear me out. All the user has to do is enter a bunch of integers. Then the application prints the largest sum of a strictly ascending sequence of the array. A strictly ascending sequence is a sequence where the current number is always lesser than the next number.
For example, the user enters 2 4 5 1 7 3, the output should be 11 (2 + 4 + 5).
Then that’s it! I think this is going to be a hit! Don’t you think? Well I do. If you help me then we’re going to be rich!
Note: For this problem, a sequence must contain at least 2 numbers. If there is no sequence found, then the largest sum is 0.
Output:
Enter the size: 6
Enter element #1: 2
Enter element #2: 4
Enter element #3: 5
Enter element #4: 1
Enter element #5: 7
Enter element #6: 3
Largest sum = 11Given the number of people attending a pizza party, output the number of needed pizzas and total cost. For the calculation, assume that people eat 2 slices on average and each pizza has 12 slices and costs $14.95.
Output each floating-point value with two digits after the decimal point, which can be achieved as follows:
System.out.printf("Cost: $%.2f\n", cost);
Ex: If the input is:
4the output is:
Pizzas: 1
Cost: $14.95Hint: Use the ceil() method to round up the number of pizzas so that enough pizzas are ordered.
Find the odd one out with reason:
ask user to input howmany members’ information will be entered into the system. Using linked list, program should accept asked information. Upon giving the neededinformation of each member,the system will display the information of each member. Use data types for each member of the linked list.
sample output below:
How many members’ information will be entered? 2
Kindly give the information of member #1
Enter first name: Sam
Enter middle name: Hui
Enter last name: Messi
Enter area code: 035
Enter telephone number: 999-22
Enter gender: male
Enter age: 9
Kindly give the information of member #2
Enter first name: Kim
Enter middle name: Prim
Enter last name: Cole
Enter area code: 047
Enter telephone number: 08-0978
Enter gender: female
Enter age: 18
Welcome to the club Sam Hui Messi!
Your area code and telephone number is (035) 999-22.
You are a male member, and your age is 9.
Welcome to the club Kim Prim Cole!
Your area code and telephone number are (047) 08-0978.
You are a female member, and your age is 18.
ask the user to input how many members’ information will be entered into the system. Using a linked list, the program should accept information such as first name, middle name, last name, area code,telephone number, gender, and age. sample output below:
How many members’ information will be entered? 2
Kindly give the information of member #1
Enter first name: Sam
Enter middle name: Hui
Enter last name: Messi
Enter area code: 035
Enter telephone number: 999-22
Enter gender: male
Enter age: 9
Kindly give the information of member #2
Enter first name: Kim
Enter middle name: Prim
Enter last name: Cole
Enter area code: 047
Enter telephone number: 08-0978
Enter gender: female
Enter age: 18
Welcome to the club Sam Hui Messi!
Your area code and telephone number is (035) 999-22.
You are a male member, and your age is 9.
Welcome to the club Kim Prim Cole!
Your area code and telephone number are (047) 08-0978.
You are a female member, and your age is 18.
Create a program in Java that will enter a number and check if the given number is odd or even number.
Sample output:
Enter a number to be check: 18
Number 18 is even number
OR
Enter a number to be check: 18
Then entered number is even number