Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA PROGRAM Help! Please use the following information to write this program in Java and match it with sample output. The first two pictures are

JAVA PROGRAM Help!

Please use the following information to write this program in Java and match it with sample output.

The first two pictures are the incomplete input for us to fill out the rest input by following the instruction in the third to fifth picture,

The sixth and seventh pictures are the output sample of what the program shoulld look like.

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

CSE 11 30 1 2017 4. PROGRAMMING ASSIGNMENT 4 Read: Prog Ansigements 55 2017 Deitel: Ch 7-8 Programming: Name your DUE tou will write an a Liang:Ch 9, App D your TWO SEPARATE tsless pa. 1ava and p43tockPund 3ava Tuesday, July 18. : 17 @ 6am pplication program to compute the yearky interest for investnt using classes, conatructors, public mnethodaand private instance variables Assignment 4 mport ava.util.scanner P4ava .. tile header comment) // Scan imput frcm keyboaed public class P4(elass header comment public class P4 : Instantiates 2 P4StockFund objects for beginning balances inet publie statie void maint Stringtl azgs / 1st year to open account // Start to buy 10 shares // Year to Date Rate of Return Invest : 13.9% final int YEAR1 final double START BUY10 final double YTD R01 .139; boolean isFirstRun true boolean errRate = false; int Ratee double rate double fundShares // No input on tirst run // Valid rate of roturn // Loop counter // New fund shares Year Scanner scan -new Scanner (System.in) Read input from keyboard // Repeat progran string inputstrne String ) P4StookFund investori-new P4Stock Fund (START BUY) I overloaded double ctor P4StockFund inves tor2 now P4Stockgund ( ) ; P4StockFund. setRateROI YTD-ROI ) ; do /I No arg ctor. Start 10 shares if isFirstRun /I Testing otor, no input iat run do investorl. buyShares ( START BUY) Start buy 10 shares //- Teat input for new starting fund shares while errFundShares)i do System . out . print(" Enter new % rata of raturn (.01): " ) rate scan . nex tDoub10 ( ) ; if errRate investor2. setRateROI (rate) ) system out.print ("grror! Enter valid Range of "; system.out.printin( P4StockFund. MIN ROI to PAStockFund. MAX ROI) whilet EERato) whilet errRate // Allow input after ist run System . out, printf( " %-7st11st16s ", "YEAR", -INVESTOR 1", .ENVESTOR 2-1 System . out . printf( " %-7s4 11s%16s " , "-ww-", "==== " , "sssssss=" ) ; System . out.printf ( " %-7s11sussla", "Base", investorl tostring(), investora for ( year MON1 year

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

Step: 3

blur-text-image

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

The Accidental Data Scientist

Authors: Amy Affelt

1st Edition

1573877077, 9781573877077

More Books

Students also viewed these Databases questions