0% found this document useful (0 votes)
4 views5 pages

Proposed Java Exercises

The document outlines a series of Java programming exercises that involve multiple selective structures. These exercises cover various scenarios such as calculating discounts based on ball colors, vehicle tolls, worker salaries based on hours and categories, and determining zodiac signs and seasons based on birth dates. Additionally, it includes tasks for calculating hospital costs, phone call expenses, and family allowances based on the number of children.

Translated by

ScribdTranslations
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views5 pages

Proposed Java Exercises

The document outlines a series of Java programming exercises that involve multiple selective structures. These exercises cover various scenarios such as calculating discounts based on ball colors, vehicle tolls, worker salaries based on hours and categories, and determining zodiac signs and seasons based on birth dates. Additionally, it includes tasks for calculating hospital costs, phone call expenses, and family allowances based on the number of children.

Translated by

ScribdTranslations
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

JAVA EXERCISES MULTIPLE SELECTIVE STRUCTURES

In a supermarket, discounts are given for purchases starting from certain little balls.
of colors. If the customer pulls out a blue ball, they get a 20% discount, if the
the ball is red, a 30% discount is applied and if a white ball is drawn, it does not
applies no discount. Design a program that based on the purchase amount and
the color of the ball shows what the customer must pay.

2. Create a program that calculates the amount to be paid for a vehicle when driving through
a highway. The vehicle can be a bicycle, a motorcycle, a car, or a truck.
To define the set of vehicles, a switch structure must be used. The amount
it will be calculated according to the following data:

oAn amount of 0.5 soles per km for the bike.


o Motorcycles and cars will pay 2 soles per km.
oThe trucks will pay 5 soles per km plus 3 soles per ton.

The type of vehicle, the kilometers to be traveled, and if it is a truck must be entered.
tons carried.

3. It is desired to calculate the salary of a worker, based on the hours worked in the
week and the class to which it belongs: Class "A" Workers are paid 25 soles
per hour. Class 'B' workers are paid 20 soles per hour. Class 'C' workers,
They are paid 15 soles per hour and those of class 'D', 10 soles per hour.
A merchant is dedicated to selling chairs only. He sells three types of chairs:
Type A, Type B, and Type C prices are 20, 35, and 50 soles respectively. For each
five chairs purchased of type A, type B or type C the customers receive a
3%, 5%, and 7% discount, the others are charged at the normal price.

Create a program to enter the type of chairs to buy, the number of chairs and
report the amount to be paid.

5. Given as input 3 integers representing the date as day, month, year, print
la fecha del día siguiente. Por ejemplo para una entrada como: 29 2 2004 La salida
The date following 29-2-2004 is 1-3-2004.
6. Enter the day and month of birth and report your zodiac sign.
7. Enter the day and month of a date and report the season it belongs to:
summer, autumn, winter or spring.
8. Enter the salary of a worker, category, condition (Permanent, contracted) and
report the total payment that is owed according to the following:
The percentage of Bonus (in relation to the salary) is calculated according to the
next table:
Category Stable Not Stable
A 20% 17%
B 18% 15%
C 15% 14%
D 12% 10%
The The discount calculation is based on the (Salary + Bonus
Stable: 6% Not stable: 4%
10. Enter the cost of an Item and the type of Device and then report the discount
what is applied to them and the gift that will be given to a customer.
Depending on the type of appliance, a discount will be applied and a gift will be given.
as stated in the table.
Type Discount Rate (On the Obsequy
cost
Audio 8% Blender
Video 9% Mixer
White Line 0% Iron
11. Enter 2 numbers and then a character indicating the operation to perform (+,-,*,/,^)
report the result of the operation.
12. A company pays its salespeople a gross salary that is equal to the sum of a
basic salary of S/. 250 plus a commission that is equal to a percentage of the amount
total sold. The commission percentage depends on the seller's category
according to the following table:

Category Percentage of
Commission
1 14.25%
2 13.00 %
3 11.75%
13. On the other hand, if the gross salary of the seller is greater than S/. 3500, a
discount equal to 15% of the gross salary; otherwise, a discount is made
equal al 10% del salary gross
Create a program that determines the basic salary, the commission, the gross salary, the
discount and the net salary of a salesperson of the company.
14. A store sells three types of products whose codes are A, B, and C at the prices
unitary given in the following table:
Código Price
Unitary
A 25
B 35
C 45

15. As an offer, the store provides a percentage discount on the amount of the
purchase according to the following table:

Amount Discount
Purchase
>=700 16%
>=500 but < 14%
700
>=200 but 12%
<500
< 200 100%

16. Create a program that determines the purchase amount, the discount amount
and the amount to be paid for the purchase of a certain quantity of units of the same type
of product.

17. Create a program that allows calculating the total payment of a worker according to

Bonus: regarding the salary


Type Male Female
Single 8% 10%
Married 10% 12%

Discount: regarding salary + bonus


Type Male Female
Single 6% 5%
Married 4% 3%

the following:

19. The worker's salary, gender, and marital status must be entered and reported for bonuses.
discount, and the total payment

20. Enter an integer between 1 and 3000 and report it in letters, for example if
we enter the number 52 it should report fifty-two
21. It is desired to calculate the cost of hospitalization for a patient in a clinic, for this
the type of treatment shown in the table, the age, and the
number of days of hospitalization. It is known that clients over 60 years old have
a 25% discount and customers under 25 years old, 15%.
Type of Cost
Treatment Internment for
day
1 400
2 300
3 250
4 180
22. The cost of a phone call depends on the geographic area in which it is made.
find the destination country. The table shows the cost of 60 seconds accordingly
a the zone geographical.
Create a program to calculate and print the total cost of a call, it must
enter the geographic zone key and the duration of the call (in seconds)
Key Zone Price
1 States 0.13
United
2 Canada 0.11
5 America of 0.22
On
6 America 0.19
Central
7 Mexico 0.17
9 Europe 0.17
10 Asia 0.20
15 Africa 0.39
20 Oceania 0.28
23. Develop a program that executes the selected option according to the following:
oTriangle area (Request base and height)
oSquare Area (Request side)
oCircle Area (Request radius)
oRectangle Area (Request base and height)
In the two-player game called 'ROCK, PAPER, AND SCISSORS', each player chooses
be 'T', 'R' or 'P' respectively. The player is determined as follows: rock breaks scissors,
the scissors cut the paper, the paper covers the rock, the game is a tie if both
players choose the same option. Develop a program to determine which one
player wins, the output should be shown as follows: "T-R Roca breaks"
scissors wins player 2.
25. A company wants to calculate the productivity of a given month, this is calculated as
continue:
January February y March they have factor 15
April May y June they have factor 17
September October y November they have factor 20
December has a factor of 21

A program is requested to be developed that allows the user to request any month and...
calculate the productivity if it is known that it is equal to the number of items
producidos en el mes multiplicado por el factor del mes que corresponda al mes
provided. The number of items produced and the month is known

26. The family allowance per child of a worker is as follows:


oIf you do not have children, you are not entitled to family allowance.
o If you have a child, you are entitled to 50 soles.
oIf you have two children, you are entitled to 75 soles for your two children.
oAnd if you have more than two children, you will receive 100 soles.

Enter the number of children and report the family allowance

You might also like