If P is pressed, ask the user to type his rate (pay) per hour and the number of hours he worked for the entire month separated by a space. Then, display his name and wage.
storing the input to the next variable name based on data type
For String s.nextLine()
For int s.nextInt()
For double: s.nextDouble()
Create objec-oriented programming that well implement this principle:
"According to plato, a man should marry a woman who is half his age plus 7 years"
Create the following:
1. Two (2) classes (MyMainClass & TheOtherClass)
2. Two (2) mutator methods:
•setName - accepts a man's name then copies that name to the attribute "name"
•setAge - accepts a man's age then copies that age to the attribute "man_age"
3. Two (2) accessor method:
•getName (String) - returns the man name attribute "name"
•getWomanAge(int) - returns the woman's age attribute "woman_age"
Sample output:
Enter the man's name: Hansel
Enter the man's age: 36
Hansel should Mary a girl who's 25 years old.
5) You have been appointed the chief IT manager of Housing Finance Corporation. At the moment, the operations are manual and the management would like you to automate them.
Assume the following details:
Ø Employees Names
Ø Box Number
Ø Town
Ø Personnel Number
Ø Department
Ø Basic Salary
Ø Consolidated Allowances
Required:
i) Write a JAVA class declaration for the above. (6 mks)
ii) Write appropriate function definitions. (5 mks)
iii) Write the appropriate driver program (main function
1) A fibonacci series is defined as follows:-
Fb[0] = 0
Fb[1] = 1
Fb[i] = Fb[i – 1] + fb[i – 2] for i >= 2
Write a program that generates the first n (the user decides how many) fibonacci terms and prints them. The program should also print their sum. (Use array(s))
1) Write a program that accepts the amount of money deposited in a bank account, the annual interest rate and the target amount (The amount of money the account holder wants to have in the account after a period of time) and then calculates the number of years it will take for the money to accumulate to the targeted amount. NB: 1) The interest being earned is Compound Interest. 2) Don’t use the formula for calculating compound interest.
For example if the money deposited is 10000 and the target amount is 20000 and the account earns an interest rate (compound) of 10% pa, then the output should be: -
It will take 8 years for your money to reach your target.
By the end of this period, the amount in your account will be 21435.89
1) Write a program that accepts a set of integers (the user decides how many) and then stores them in an array. The main function then passes these values one by one to a method called get_even which returns 1 if the integer is even and 0 if it is odd. The main function should then specify which numbers were even, which ones were odd and their respective totals. It should also specify how many numbers were odd and how many were even. For example, if the user enters 25 34 56 17 14 20, the output should be: -
25 is an odd number
34 is an even number
56 is an even number
17 is an odd number
14 is an even number
20 is an even number
There is a total of 2 odd numbers and their sum is 42.
There is a total of 4 even numbers and their sum is 124.
NB: All data input and output should be done in main. Don’t use % any where in the main function (% can be used in the method).
Create a class called Triangle that stores the length of the base and height of a right-angled triangle in two instance variables. Include a constructor that sets these values. Also include a default constructor. Define two functions. The first is hypot( ), which returns the length of the hypotenuse. The second is area( ), which returns the area of the rectangle. (8 mks)
ii) Write an appropriate driver program for the class created above. (4 mks)
Create a JAVA class for Bank Account abstract data type. It should have the attributes account number (integer), account holder (string) and current balance (float). Define methods to get and set account numbers and account holders (total = 4). Add a method, which will return the account holders current balance. Finally, add two methods, which allow deposit and withdrawal of money updating the current balance as appropriate. NB: Dont add any other methods (member functions)
Using the Bank Account class above, write a program to test these methods as follows: -
i) Create three bank accounts, two to start with balances 0.00 and one with 2,000.
ii) Set the account numbers to 101,102 and 103 respectively.
iii) Set names of account holders.
iv) Credit (deposit) account 101 with 2,000.00 and account 102 with 1,750.00.
v) Debit (withdraw) account 103 with 1,250.00
vi) Display the account numbers, account holders and current balance for the three
Write a program that will make use of a class called Credit to determine if a department store customer has exceeded the credit limit on charge account for each customer, the following facts are available
Account Number
Balance at the beginning of the month.
Total of all items charged by this customer this month.
Total of all credits applied to this customer account this month
Credit Limit.
The program should input each of those facts, calculate balance (= beginning balance + charges credits) and determine if the new balance exceeds the customers credit limit. For those customers whose credit limit is exceeded the program should display the message Credit Limit Exceeded otherwise the message Within the credit limit should be displayed. The program should include a loop that lets the user repeat this calculation until he or she is thr