2a.self-Practice_Introduction to Java - Questions
2a.self-Practice_Introduction to Java - Questions
Practice No. : 2a
Date : 13.02.2025
Question
Question Detail Level
No.
4 We're hosting a party with tea and candy. The outcome of the Easy
party is encoded as follows: 0=bad, 1=good, or 2=great. A party
is considered good (1) if both tea and candy are at least 5. If either
tea or candy is at least double the amount of the other one, the
party is great (2). However, if either tea or candy is less than 5,
the party is always bad (0).
Sample Input: 6 8
Sample Output: 1
Sample Input: 3 8
Sample Output: 0
Sample Input: 20 6
Sample Output: 2
5 Given 2 non-negative ints, a and b, return their sum, so long as Easy
the sum has the same number of digits as a. If the sum has more
digits than a, just return a without b.
Sample Input: 2 3
Sample Output: 5
Sample Input: 8 3
Sample Output: 8
8 Write a Java program to calculate Net Salary. User must input Easy
Basic Salary and Output should be net salary calculated based on
the following allowances:
Allowances:
DA = 70% of Basic Salary
HRA = 7% of Basic Salary
MA = 2% of Basic Salary
TA = 4% of Basic Salary
Deduction:
PF = 12% of Basic Salary
Income/professional tax = User Input (e.g., 500)
Net Salary = Basic Salary + Allowances – Deduction