Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Lab 4: 1D & 2D arrays, Lookup tables, Nested Loops (20 pts.) Labs made available to ALL students on WED students and are due by
Lab 4: 1D & 2D arrays, Lookup tables, Nested Loops (20 pts.) Labs made available to ALL students on WED students and are due by 5:30pm on Fri. Labs are accepted late through 11:59pm Friday but will incur a 20% late penalty. Students must attend either their scheduled lab on Wed, Thu or Fri in DUE 1114 or attend any of the labs virtually via zoom. It is important that students attend the labs in which they are enrolled.) Students must run their program for a teaching assistant and get checked off before submitting to get full credit. Those submitting a lab without getting it checked off will automatically lose 20%. Lab assignments can NOT be made up or submitted after the 11:59pm Friday deadline - no exceptions. There is a make-up lab the last week of the course to make-up any missed lab. FYI: Since all students are completing the SAME Lab, a reminder you must submit your OWN work. It is the only way to learn the material. It is OK to help your neighbor out on this lab as long as each student is doing their own work and each understands what they are doing (no working together on exams...) Use the notes from this week's lecture and the examples posted in Canvas to help you complete the lab. Reminder that 2-D arrays are covered in Chapter 5.9 in your zyBook. Before you begin, DOWNLOAD the file Lab4.java from Canvas to your network drive at KSU (not the local hard drive/desktop) or your personal computer, if working at home. Once you have the file saved, open the file. Period 5% 10% 1 1.0500000 2 1.1025000 1.1576250 3 4 Growth of $1 Using Compounded Interest 6% 7% 8% 9% 1.0600000 1.0700000 1.0800000 1.0900000 1.1236000 1.1449000 1.1664000 1.1881000 1.1910160 1.2250430 1.2597120 1.2950290 1.2624770 1.3107960 1.3604890 1.4115816 1.3382256 1.4025517 1.4693281 1.5386240 1.4185191 1.5007304 1.5868743 1.6771001 1.5036303 1.6057815 1.7138243 1.8280391 1.5938481 1.7181862 1.8509302 1.9925626 1.6894790 1.8384592 1.9990046 2.1718933 1.7908477 1.9671514 2.1589250 2.3673637 5 1.1000000 1.2100000 1.3310000 1.4641000 1.6105100 1.7715610 1.9487171 2.1435888 2.3579477 2.5937425 1.2155063 1.2762816 1.3400956 1.4071004 1.4774554 1.5513282 1.6288946 6 7 8 9 10 Part 1: - Within the provided file (Lab4.java), the following has been done for you: Declare and initialize a 2D array of doubles to hold the values listed in the lookup table above. Study the code and ask a TA if you do not understand what is being done. Then, ... - Declare a constant to hold the number of clients (5). - Use a for loop to read in info for 5 separate clients. For each client, ask the user to input the client's name (store in a String array), the amount to be invested (assume int $100-$10,000) the interest rate (assume int 5-10 percent) and the term (years) of the investment (assume int 1-10). Store these last 3 values in either 3 separate, parallel int arrays or a single 2D array. (You will, therefore, either have 4 single-dimensional arrays or 1 single-D and 1 multi-D array) - After all values have been entered in for all 5 clients, use another for loop for your output. Use the 2D lookup table to determine the Compound Value and the Compound Interest earned by each client and display with a $-sign and 2 decimals (along with their name) as shown below. Compound Value is calculated by looking up the value for the given rate and years and multiplying by the investment amount. For example: $100 at 7% for 3 years would be $100 * 1.2250430 = $122.50. (FYI: User input will be on 4 separate lines, entering name, then investment, then interest, then term; might want to set number of clients to 2 until you get the first two clients working) Given Input: Read in one value per line...Name then amount then rate then year Bob, 100, 7,3 Fred, 1000, 6, 6 Sally, 560, 9, 10 John, 999, 8, 8 David, 10000, 10, 10 Sample output (if you are off by +/- $0.01, that's fine) Commas are nice but NOT required. If alignment is slightly off, that's OK. Bob Compound Value: $122.50 Interest: $22.50 Fred Compound Value: $1,418.52 Interest: $418.52 Sally Compound Value: $1,325.72 Interest: $765.72 John Compound Value: $1,849.08 Interest: $850.08 David Compound Value: $25,937.43 Interest: $15,937.43
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started