1. Stock Commission. An investor buys shares of stock at a particular price per share through their stock
oker. The investor must pay their stock
oker a commission for the transaction. The commission paid to the stock
oker is a flat rate of 4.25% of the total cost of the shares. Write a program that when given the number of shares purchased and the share price will calculate and display the following:
Â· The amount paid for the stock alone (without the commission)
Â· The amount of the commission
Â· The total amount paid (for the stock plus the commission)
a) Â Plan a solution by producing an IPO chart for the problem and an initial algorithm. b) Â Convert your algorithm into a Java program. The name of the class file should be StockCommission. Compile and test your code in Eclipse.
c) Â Modify your algorithm in part a to ensure that the user cannot enter an invalid number of shares, share price, or commission rate. Number of shares must be between 100 and XXXXXXXXXXShare price must be greater than $0 but less than or equal to $500.00.
XXXXXXXXXXd) Â Update your Java program to incorporate the validation from part c
2. Number Statistics.
Write a program that lets the user enter a series of decimal numbers (ie, numbers that may have a decimal point) that lie in the range -50,000 to 50,000. The user should enter 0 to signal the end of the series. The program must count the number of positive and negative numbers entered. After all the numbers have been entered by the user, the program should display the number of numbers entered, the total of the positive numbers, the total of the negative numbers, the average of the negative numbers, the average of the positive numbers, the average of all positive and negative numbers combined, and the largest and smallest numbers. Ensure that the sentinel value is not included in any of the statistics. The Scanner class must be used for keyboard input.
Note: Plan a solution by producing an IPO chart and an initial algorithm for the problem, then write and test the Java source code.
Class file name: The name of the class file should be Statistics
3. Koala Population.
Write a program that will predict the size of a koala population over time (years). The program should ask for the starting number of koalas, their average annual population increase (as a percentage), and the number of years they will multiply. For example, a koala population might begin with 1000, have an average annual increase of 2 percent, and allowed to multiply for twelve years. The program must display the predicted size of the koala population for each year. Do not accept a number less than 500 for the initial size of the population. Do not accept a negative number for average annual population increase (note: average annual population increase already includes koala deaths due to old age, disease, predatory hunting, natural disasters, etc). Do not accept a number less than 10 for the number of years the population will multiply. The Scanner class must be used for keyboard input.
Note: Plan a solution by producing an IPO chart and an initial algorithm for the problem, then write and test the Java source code.
Class file name: The name of the class file should be Koala
3. Stock Commission. Copy your code solution Stock Commission from question 1, into your project. Modify your solution to incorporate appropriate methods utlising appropriate parameter passing. The functional requirements are the same (including the validation of shares and share price) except, the commission rate must be entered by the user in the range 1 to 5.5%.