Hi, I’m Dr. Jilesh !A professional spell caster,
– Expert in Hoodoo / conjure works, Angelic Healer (Academy of Ancient Magick)
-Tarot Reader, Psychotherapist, Reiki Grand Master 9th degree (Authorized instructor and trainer)
Check this link
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Oop lab assignment 01
1. OOP Lab Assignment 01
Problems Solving List:
1. Write a program that sorts three integers ascendingly. The integers are entered from
the input dialogs and stored in variables num1, num2, and num3,respectively.
Input: 50 1 90
Output: 1 50 90
2. Write a program that prompts the user to enter an integer and checks whether the
number is divisible by both 5 and 6, or neither of them, or just one of them.
Here are some sample runs for inputs 10, 30, and 23.
10 is divisible by 5 or 6, but not both
30 is divisible by both 5 and 6
23 is not divisible by either 5 or 6
3. Write a program that reads three edges for a triangle and determines whether the
input is valid. The input is valid if the sum of any two edges is greater than the third
edge. Here are the sample runs of this program:
Input: 1 2.5 1
Output: false
Input: 5 10 11
Output: true
4.
The problem is to write a program that computes loan payments. The loan can be a car
loan, a student loan, or a home mortgage loan. The program lets the user enter the
interest rate, number of years, and loan amount, and displays the monthly and total
payments.The formula to compute the monthly payment is as follows:
You don’t have to know how this formula is derived. Nonetheless, given the
monthly interest rate, number of years, and loan amount, you can use it to compute the
monthly payment.
**Compute the total payment, which is the monthly payment multiplied by 12 and
multiplied by the number of years.
2. 5. Write a program that reads an integer between 0 and 1000 and adds all the digits in
the integer. For example, if an integer is 932, the sum of all its digits is 14.
Hint: Use the % operator to extract digits, and use the / operator to remove the
extracted digit. For instance, 932 % 10 = 2 and 932 / 10 = 93.
Input: 999
Output: 27
6. Write a program that receives an ASCII code (an integer between 0 and 128) and
displays its character. For example, if the user enters 97, the program displays a
character.
Input: 69
Output: E
7. Write a program that prompts the user to enter two points (x1, y1) and (x2, y2) and
displays their distances. The formula for computing the distance is
Input: Enter x1 and y1: 1.5 -3.4
Enter x2 and y2: 4 5
Output: The distance of the two points is 8.764131445842194
8. Write a program that prompts the user to enter three points (x1, y1), (x2, y2), (x3, y3) of
a triangle and displays its area. The formula for computing the area of a triangle is
Input: Enter three points for a triangle: 1.5 -3.4 4.6 5 9.5 -3.4
Output: The area of the triangle is 33.6
9. (Counting positive and negative numbers and computing the average of numbers) Write
a program that reads an unspecified number of integers, determines how many
3. positive and negative values have been read, and computes the total and average
of the input values (not counting zeros). Your program ends with the input 0. Display
the average as a floating-point number.
a. Sample Input: 1 2 -1 3 0
b. Sample Output:
The number of positives is: 3
The number of negatives is: 1
The total is : 5
The average is: 1.25
10. (Conversion from kilograms to pounds) Write a program that displays the following
table (note that 1 kilogram is 2.2 pounds):
Kilograms Pounds
1 2.2
3 6.6
...
197 433.4
199 437.8
11. Write a program that reads an 10 student scores and determines
a. Average score and print it
b. how many scores are above or equal to the average
c. and how many scores are below the average.
Enter a negative number to signify the end of the input.
12. Write a program that reads in ten numbers and displays distinct numbers (i.e., if a
number appears multiple times, it is displayed only once). Hint: Read a number and
store it to an array if it is new. If the number is already in the array, ignore it. After the
input, the array contains the distinct numbers.
Here is the sample run of the program:
Enter ten numbers:1 2 3 6 4 5 1 2 3 2
The distinct numbers are: 1 6 3 4 5 2
a. displays count of distinct numbers
13. (Math: combinations) Write a program that prompts the user to enter 10 integers
and displays all combinations of picking two numbers from the 10.
14. Write a program to sort n numbers in decreasing order. The program will take an
integer n: how many numbers following the n numbers.
4. a. Sample Input: 5
3 9 1 5 12
Sample Output: 12 9 5 3 1
15. (Checking password) Some Websites impose certain rules for passwords. Write a
method that checks whether a string is a valid password. Suppose the password rule is
as follows:
■ A password must have at least eight characters.
■ A password consists of only letters and digits.
■ A password must contain at least two digits.
Write a program that prompts the user to enter a password and displays "Valid
Password" if the rule is followed or "Invalid Password" otherwise.
16. * (Occurrences of a specified character) Write a function named “countChar” that finds
the number of occurrences of a specified character in the string. For example,
countChar("Welcome", 'e') returns 2. Write a test program that prompts the user to enter
a string followed by a character and displays the number of occurrences of the character
in the string.
17. **(Common prefix) Write a function that returns the common prefix of two strings. For
example, the common prefix of "distance" and "disinfection" is "dis". If the two strings
have no common prefix, the function returns an empty string.
Write a main function that prompts the user to enter two strings and display their
common prefix.
5. LAB Performance 01:
Write a program that
1) Take two numbers T and N as an input. T & N both are integers. T
representthe test case.Foreach T
2) Find the divisors/factorsof N
3) For each test case print the case no and factors of the given number
Sample Input: 3
6 4 2
Sample Output:
Case 1: 1 2 3 6
Case 2: 1 2 4
Case 3: 1 2