Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is using java (INTELLI J) and Gradle. I will appreciate if you can help me to solve those problems. I am starting learning programming+

image text in transcribed

This is using java (INTELLI J) and Gradle. I will appreciate if you can help me to solve those problems. I am starting learning programming+ java, so it is kinda difficult for me to solve and get the correct results of this.

****PLEASE, If you make a comment before making each part, I will appreciate it. (EX. //methods for ... ). It will help me to understand and follow what you are writing and doing.

THANK YOU!

Question 1 Create a class called InvalidParamterException that extends the java class named Exception. Add a single constructor that accepts a String argument. The constructor simply calls the parent class (hint: remember what the keyword super does) using the String passed to constructor. Question 2 Create an interface called Investment with the following methods: name: returnValue, arguments: none, returns: double, access: public, throws: InvalidParameterExcep- tion name: returnProfit, arguments: none, returns: double , access: public, throws: InvalidParameterExcep- tion Question 3 a) Create a class called Cash Money that implements Investment with the following fields: name: amount, type: double, access: private name: monthlyInterest, type: double, access: private name: investment Months, type: int, access: private b) Create a default and a parameterized constructor for the CashMney class. The parameterized constructor should accept all 3 fields in the class. c) Populate the approriate methods from the Investment interface. Use the interest rate and number of months of investment investment Months) to calculate the value and profit of the investment. Don't overthink this. Use the following formula to calulate the value of the investment: value = amount x (1 + rate number of periods profit = value - amount d) In your return Value method, determine if either the interest rate or length of investment is negative. If so, throw a custom InvalidParameterException with the message below. Note that a try/catch is not required in this method. CashMoney field values are not all valid

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Securing SQL Server Protecting Your Database From Attackers

Authors: Denny Cherry

1st Edition

1597496251, 978-1597496254

More Books

Students also viewed these Databases questions

Question

Compute an expression for P max t1st2 B(s) > x

Answered: 1 week ago