Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1 You will create JavaScript code - embedded on an HTML file - according to the requirements listed on the next pages. 2 Upload
1 You will create JavaScript code - embedded on an HTML file - according to the requirements listed on the next pages. 2 Upload and submit a single html file (.html extension) containing the code required. PROBLEM DESCRIPTION An Investment Club needs a program to generate a summary report of the investment made by its members. You are required to implement the interface required using the JavaScript programming language. A GUI screen is not required. A video of a sample run of this completed assignment is available on the assignment's webpage on Canvas. Inputs needed: Number of Members: a numeric value (not greater than 10). The program should produce an error message and terminate if a number greater than 10 is entered. Per member in the club: Name: a string Investment Amount: a numeric value Output required: A Summary Report with the following: Smallest Investment: Name and amount of the smallest investment. Largest Investment: Name and amount of the largest investment. Total Investment: Total Amount invested by the club as a group. Average Investment: Average Investment per member. Projected Growth: In % terms (a number between 0% and 100%.), generated by a random number. Projected Earnings per Member: In $ amounts, based on the projected growth (projected growth % multiplied by investment). It should list the name and projected earnings for each member. Additional Notes: Use the prompt function to gather the inputs. The document.write function should be used heavily to generate the Summary Report. NOTE: The projected growth and earnings part of the Summary Report will produce different results each time the program runs due to the use of a random number. Requirements: Arrays: Use two parallel arrays to hold the information related to the names and investments per member. Functions Functions are required to: Calculate the Smallest Investment Calculate the Largest Investment Calculate the Total Investment A function is also required to generate the projected earnings per member. Tip: Use a loop to process the elements of the arrays. Page 2 of 4 SAMPLE TEST DATA and RESULTS Sample Data Inputs: Number of Members 3 Name Investment (numbers in thousands) John 20 Mary Paul 10 30 Outputs: Smallest Mary, $10 Investment: Largest Paul, $30 Investment: Total $60 Investment: Average $20 Investment: Projected 47% Growth: Projected John: $9.40 Earnings per Mary: $4.70 Member: Paul: $14.10 Sample Summary Report (the projected growth and earnings part of the report will produce different results each time the program runs): Investment Club Summary Report Report Date: Sun Oct 23 2022 18:54:45 GMT-0400 (Eastern Daylight Time) (All S numbers in thousands) Smallest Investment: Mary, $10 Largest Investment: Paul, $30 Total Investment: $60 Average Investment: $20 Projected growth: 47% Projected Earnings for John: $9.40 Projected Earnings for Mary: $4.70 Projected Earnings for Paul: $14.10 Additional Information: . Be sure to include a comment with your name and section in the part of your HTML code program. Since the content of a text box which requires a number may be used in mathematical operations, use the function Number() to ensure that the numeric input is treated as numeric data. Syntax example: x = prompt("Enter some number"); x = Number(x); Syntax example to round up a number to 2 decimals. Just add.toFixed(2) to the variable name containing the number. Syntax example: someNumber.toFixed(2) To simplify the comparison of text data entered by the user, it is often easier to convert this text to upper case using the notation below. Syntax example: textVariable = textVariable.toUpperCase(); To enter the date on the report use the syntax: var d= new Date(); which captures current Date/Time on the d variable. Point Values Student name inserted as comment in the head section Variable declarations and initializations Screen Flow Inputs Outputs Arrays Loops Functions IF statements Program execution References: Recitation sessions Lectures Fluency textbook Chapters 17 to 20 JavaScript Reference Guide Page 4 of 4 1 1 2 2 2 3 3 3 3 5 This page says Enter number of members 3 Cancel OK SO This page says Enter name of member John I Cancel OK This page says Enter John's investment amount 20 I Cancel OK This page says Enter name of member Mary I Cancel OK Enter Mary's investment amount 10 I Cancel OK This page says Enter name of member Paul I Cancel OK This page says Enter Paul's investment amount 30 I Cancel OK Investment Club Summary Report Report Date: Sat Oct 22 2022 17:24:11 GMT-0400 (Eastern Daylight Time) Smallest Investment: Mary, $10 Largest Investment: Paul, $30 Total Investment: $60 Average Investment: $20 Projected growth: 19% Projected Earnings for John: $3.80 Projected Earnings for Mary: $1.90 Projected Earnings for Paul: $5.70
Step by Step Solution
★★★★★
3.50 Rating (157 Votes )
There are 3 Steps involved in it
Step: 1
Heres a basic implementation of the described functionality in JavaScript javascript Function to calculate smallest investment function calculateSmall...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