Using the do…while() loop, continuously scan for random integers, but add up only all the positive integers and store the total in one variable.
The loop shall only be terminated when the inputted integer is zero. Afterwards, print out the total of all inputted positive integers.
Continuously ask for floating point values (decimal numbers) using the do…while() loop, sum them all up, and store the total into one variable.
The loop shall only terminate for the following reasons:
A negative decimal number is inputted (but still included in the total sum)
The total sum reaches 100.0 or more
Using a do…while() loop, continuously scan for characters (one per line) and print it out afterwards.
The loop shall terminate due to either of the following reasons:
The inputted character is a vowel
The number of inputted characters has already reached 5.
Using a do...while() loop, continuously scan for random integers that will be inputted by the user and print out its square, separated in each line.
Once the inputted value is 0, it will still print out its square value but should then terminate the loop afterwards. Use this concept in making your loop condition.
Each customer will type in a code representing the structure of their order, and your program will display (to standard output) a summary of the order components along with the total cost. An order code is exactly nine characters long, representing four optional toppings. The order code positions, from left to right, represent the following elements:
Four optional Items:
1. 'Y' means the customer wants corn (no additional charge), and 'N' means that the customer does not want corn.
2. 'Y' means that the customer wants guacamole ($0.50 extra), and 'N' means that the
customer does not want guacamole.
3.. 'Y' means that the customer wants sour cream (no additional charge), and 'N' means that the customer does not want sour cream.
4.. 'Y' means that the customer wants cheese ($0.50 extra), and 'N' means that the customer
does not want cheese.
Each customer will type in a code representing the structure of his or her order, and your program will display (to standard output) a summary of the order components along with the total cost. An order code is exactly nine characters long, representing five required items. The order code positions, from left to right, represent the following elements:
Five required items:
1. 'A' represents a burrito ($3.00), and 'B' represents a burrito bowl ($4.00).
2. 1 represents black beans (no additional charge), and 2 represents pinto beans (no
additional charge).
3. 1 represents white rice (no additional charge), and 2 represents brown rice ($0.50 extra).
4. 1 represents chicken ($2.00 additional), 2 represents carnitas ($2.50 additional), and 3 represents steak ($3.50 additional).
5. 1 represents mild salsa (no additional charge), 2 represents medium salsa (no additional charge), and 3 represents hot salsa (no additional charge).
You are to write a program that will allow the user to select from a menu of 3 movies available to watch. The menu should look like the following:
If the user asks to watch Movie 1, ask for the number of tickets to buy and print the total to pay. The price per ticket for Movie 1 is $8.
If the user asks to watch Movie 2, then the program must ask for his/her age before it proceeds. If the user is younger than 18 years old, the program must print a message saying "Sorry you must be 18 or older to watch this movie." If the user is 18 or older, then proceed to ask how many tickets the user wants and print the total to pay. Price per ticket for Movie 2 is $10.
If the user asks to watch Movie 3, ask for the number of tickets to buy and print the total to pay. The price per ticket for Movie 3 is $6.50.
Write a program to ask the user to input a value responding a score on a test. The value should be between 0 and 100 inclusive. Using the IF control structure to output a message containing the letter grade corresponding to the score using the following table.
Score Letter grade
0-40 F
41-55 D
56-70 C
71-85 B
86-100 A
Riya took part in a maths quiz competition. To win the prize money she has to solve a tricky question at the end.For a given list of integers, write a program where all the integers in a given index range to be added.
She will be given M multiple ranges, where she should print the sum of numbers for each corresponding range.
Note: The limits in the range are both inclusive.
Input
The first line f input is space-separated integers.
The second line of input is a positive integer M denoting the number of index ranges.
The next M lines contain two space-separated integers of the range.
Output
The output should be M lines.
Each line contains an integer that represents the sum for the corresponding ranges.
Sample Input1
1 3 4 5 6
5
3 5
Sample Output1
12
[Please test the sample test cases and send the screenshots].a) Create a java project named school
b) Add two classes, namely student and lecturer
c) In student class, create the following methods:
i. calculate_stud_age – This method should take year of birth of the student as a
parameter and calculate and return the student’s age
ii. calculate_ave_mark – This method should take three marks of the student ,
Math, English and Physics marks as parameters and return the average mark
d) In the lecturer class, create the following methods:
i. get_name – This method should take a string (name of the lecture) and
an integer (experience of the lecturer in years). This method should
output/display the name of the Lecture together with his/her designation
based on the years of experiences determined by the following:
Professor – if experience is >= 20 years
Associate professor – if experience is >=15 years
Senior lecturer – if experience is >= 10 years
Associate lecturer – if experience is >=5 years
Junior lecturer – if experience is <5 years