Reference no: EM132409036
Topic: Control Structures
1. Create a class called EvenNos
Write a program that will add the first 100 even numbers.
2. Create a class called LargestDecimal
Write a program that prompts the user to enter three different decimal numbers and prints out the largest of them.
3. Create a class called CharPrint
Write a program that reads in a word and prints out each character of the word on a separate line. Hint: use a “for” loop and the charAt method.
4. Create a class called ReverseWord
Write a program that reads in a word and prints it out in reverse.
5. Create a class called Tuition
Tuition fees for a university is £9,000 this year and it increases by 6% every year. Write a program to allow the user to enter their current age and get the program to work out the user’s age when the tuition fees is three times the initial fee of £9000.
Challenge
Work on the Balance and BMI classes from previous exercise.
6. Amend the Balance class to work out the balances after the first, second, third etc. up to and including the tenth year. Once again, your program should prompt the user to input a starting balance and interest rate (intRate). Balance for a year is calculated as (1 + intRate) multiplied by balance for the previous year.
Example: For 5% interest rate, the user should enter 0.05
7. Amend the class called BMI
Body Mass Index (BMI) is a measure of health on weight. It can be calculated by taking your weight in kilograms and dividing by the square of your height in meters.
Write a program to allow the user to enter their weight in pounds and height in inches. Note that if one pound is 0.4535 kilograms and one inch is 0.0254 meters, display the BMI for the user.
Add additional lines of code to display a message to say “you are over-weight” if the BMI exceeds 25 or display a message to say “you are under-weight” if the BMI is 20 or less otherwise, display a message to say “you are fine”
Make further enhancements to ask the end user how times they want to run this program and then alter your code to accommodate this request.
8. Create a class called UserDetails so that the following is repeated 3 times for 3 separate users.
Ask user to enter their firstname
Ask user to enter their lastname
Write code to work out the user’s username by taking the first 3 letters of their firstname and first 2 letters of their lastname. The username should be in uppercase.
In addition, you need to ask the user their age and if they have a driving licence. Display fullname using title case, username and age if and only if the user has a driving licence.
9. Create a class called Stars. Use nested for loops to generate the following output:

10. Create a class called GuessNum.
Write code that randomly generates an integer between 1 and 100, inclusive. The program prompts the user to enter a number continuously until the number matches the randomly generated number. For each user input, the program tells the user whether the input is too low or too high, so the user can choose the next input intelligently. Display the number of attempts made for the user to guess the number.