03.2 - PB Java Conditional Statements Advanced Lab
03.2 - PB Java Conditional Statements Advanced Lab
Problems for exercise and homework for the "Programming Basics" course @ SoftUni Global.
Submit your solutions in the SoftUni Judge system at: https://judge.softuni.bg/Contests/2391
1. Day of Week
Write a program that reads an integer entered by the user and prints a day of the week within [1 ... 7] or prints
"Error" if the number entered is invalid.
You already have a project with one console application in it. It remains to write the code to solve the problem.
2. Create a main method and write the solution of the problem. You can help yourself with the code from the
pictures below:
4. Print the day of the week according to the number entered. If it is invalid, print "Error".
© SoftUni – https://softuni.org. Copyrighted document. Unauthorized copy, reproduction or use is not permitted.
2. Print a working day or day off, depending on the day you entered. If the day is invalid, print it "Error":
© SoftUni – https://softuni.org. Copyrighted document. Unauthorized copy, reproduction or use is not permitted.
© SoftUni – https://softuni.org. Copyrighted document. Unauthorized copy, reproduction or use is not permitted.
12 17 25 13.5
Miss Mr. Ms. Master
f m f m
2. Perform a gender check using the "equals" method, with a "true" result, and make a conditional statement
for the age and print the desired message on the console.
© SoftUni – https://softuni.org. Copyrighted document. Unauthorized copy, reproduction or use is not permitted.
5. Small Shop
An enterprising person opens neighborhood shops in several cities and sells at different prices:
city / product coffee water beer sweets peanuts
© SoftUni – https://softuni.org. Copyrighted document. Unauthorized copy, reproduction or use is not permitted.
6. Number in Range
Write a program that checks if the number entered by the user is in the range [-100, 100] and is different from 0 and
print "Yes" if it meets the conditions, or "No" if it is outside the range.
7. Working Hours
Write a program that reads an hour of the day (integer) and a day of the week (string) - entered by the user and
checks whether the company's office is open, the office hours are from 10:00(10 am) to 18:00(6 pm), from Monday
to Saturday including.
8. Cinema Ticket
Write a program that reads the day of the week (string) - entered by the user and prints on the console the price of
a movie ticket according to the day of the week:
© SoftUni – https://softuni.org. Copyrighted document. Unauthorized copy, reproduction or use is not permitted.
© SoftUni – https://softuni.org. Copyrighted document. Unauthorized copy, reproduction or use is not permitted.
© SoftUni – https://softuni.org. Copyrighted document. Unauthorized copy, reproduction or use is not permitted.