The KinniCorp Venture Capital Division has hired you for your expertise in devel
ID: 3885667 • Letter: T
Question
The KinniCorp Venture Capital Division has hired you for your expertise in developing financial management software. The Venture Capital Division meets and provides seed money to startup and growing companies. The division gives out two categories of seed money – Infancy seed money and Toddler seed money. The Infancy seed money is for the sum of $25,000, and the startup company must pay KinniCorp 5% of the gross profits (return on investment, ROI) over a 3-year period. The Toddler seed money is for the sum of $100,000, and the startup company must pay KinniCorp 3% of the gross profits over a 6-year period.
It has been suggested by the KinniCorp that there be 5 classes made, as described below:
1. VentureProgram – This is a public abstract class that implements the VentureConstants interface. A VentureProgram contains an account number, the company’s name given the capital, the amount of the seed money, the return on investment as a percent (e.g. 5 or 3), and the term length in years for the return on investment. The constructor accepts data to initialize the data attributes except for the amount of the seed money, the return on investment as a percent (e.g. 5 or 3), and the term length in years for the return on investment. Write a toString() method to print out the details for 1 object.
2. VentureConstants – A public interface that contains constant values for infancy and toddler seed money, ROI and term periods.
3. Infancy – A public class that inherits from VentureProgram. The Infancy constructor sets the seed money, ROI and term values as defined.
4. Toddler – A public class that inherits from VentureProgram. The Toddler constructor sets the seed money, ROI and term values as defined.
5. CreatePrograms – A driver class that tests the previous classes. This class must create an ArrayList of VenturePrograms. Then, in a loop, it must prompt and create venture programs and prompt and input all the relevant details (account number, company name, and type of seed money), ending when the account number entered is -1. When data entry is complete, the driver must display all the program information for each venture.
Explanation / Answer
Solution:
Please find below all the classes inplemented as asked above.
Please note the exit mechanism is not clear here. To prove rest of the requirements are implemented properly, exit mechanism is altered. Plese clearly specify once with an example if possible so that it can also be completed.
POJECT FILES:
VentureConstants.java
public interface VentureConstants {
public double INFANCY_SEED_MONEY = 25000;
public int INFANCY_TIME_PERIOD = 3;
public int INFANCY_RETURN_OF_INTEREST = 5;
public double TODDLER_SEED_MONEY = 100000;
public int TODDLER_TIME_PERIOD = 6;
public int TODDLER_RETURN_OF_INTEREST = 3;
}
Infancy.java
public class Infancy extends VentureProgram{
public Infancy(int accountNumber, String companyName) {
super(accountNumber, companyName);
super.termLength = INFANCY_TIME_PERIOD;
super.seedMoney = INFANCY_SEED_MONEY;
super.returnOfInvestment = INFANCY_RETURN_OF_INTEREST;
}
}
Toddler.java
public class Toddler extends VentureProgram{
public Toddler(int accountNumber, String companyName) {
super(accountNumber, companyName);
super.termLength = TODDLER_TIME_PERIOD;
super.seedMoney = TODDLER_SEED_MONEY;
super.returnOfInvestment = TODDLER_RETURN_OF_INTEREST;
}
}
VentureProgram.java
public abstract class VentureProgram implements VentureConstants {
int accountNumber;
String companyName;
int termLength;
double seedMoney;
int returnOfInvestment;
public VentureProgram(int accountNumber, String companyName) {
super();
this.accountNumber = accountNumber;
this.companyName = companyName;
}
public String toString() {
return "VentureProgram [accountNumber=" + accountNumber + ", companyName=" + companyName
+ ", termLength=" + termLength + ", seedMoney=" + seedMoney + ", returnOfInvestment="
+ returnOfInvestment + "]";
}
}
TestRunner.java
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
public class TestRunner {
public static final String SEED_TYPE_INFANCY= "INFANCY";
public static final String SEED_TYPE_TODDLER= "TODDLER";
public static void run() throws IOException{
List<VentureProgram> venturePrograms = new ArrayList<VentureProgram>();
BufferedReader scanner = new BufferedReader(new InputStreamReader(System.in));
System.out.println("*********PROG*********");
System.out.println();
String looper;
do{
VentureProgram obj = null;
//Taking user input
System.out.println("Please enter company name (in CAPITAL) : ");String companyName = scanner.readLine();
System.out.println("Please enter type of seed : "); String typeOfSeed = scanner.readLine();
System.out.println("Please enter account number : "); int accountNumber = Integer.parseInt(scanner.readLine());
//Deciding on the type of seed
if(typeOfSeed.equalsIgnoreCase(SEED_TYPE_INFANCY)){
obj = new Infancy(accountNumber,companyName);
}else if(typeOfSeed.equalsIgnoreCase(SEED_TYPE_TODDLER)){
obj = new Toddler(accountNumber, companyName);
}
venturePrograms.add(obj);
System.out.println("Do u wnat to continue ? ");looper = scanner.readLine(); //Current exit mechanism implemented
}while(looper.equals("y"));
System.out.println();
System.out.println("PRINTING OUTPUT ..");
venturePrograms.forEach(e -> System.out.println(e.toString()));
}
public static void main(String[] args) throws IOException {
run();
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.