Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Visual studio: C++ Write a program that will: 1. Declare a Class called Stocklist. It will encapsulate the following: a. Name of the Company (private)

Visual studio: C++

Write a program that will:

1. Declare a Class called Stocklist. It will encapsulate the following:

a. Name of the Company (private)

b. StockNode (private)

i. trading day

ii. price

iii. percent change (from previous day)

iv. pointer to the next node in the list

c. Size (private). This stores how many trading days exist in this Linked List.

d. Constructor (public). It will take in the name of the company as an argument.

e. appendNode(public). This function will take in a price as an argument. It will allocate space for the new node, set its price, trading day, and percent change (from the previous day). It will also append the new node to the list. The trading day should begin at 1. The percent change of the first trading day should be 0.0.

f. Output_Greatest_Percent_Change(public). This function will not take in any arguments. It will simply output:

i. The name of the company

ii. The day that had the highest percent change

iii. What the percent change was on that day

iv. The closing price of the stock on that day

g. Get_Size(). This will return how many trading days exist for this Linked List.

2. The main function will:

a. Prompt the user to input the name of a company

b. Input that name

c. Create a Stocklist object using the name as an argument

d. Use a loop in order to input stock prices for that company

i. When the user enters in a new price, a new node is appended to the Stocklist object.

ii. The loop will terminate when the user enters in -1 for a price.

e. Call the Output_Greatest_Percent_Change function for the Stocklist object. Only call this function if there is at least 1 trading day.

[See next page for Sample Run:]

image text in transcribed

What is the name of the company? Microsoft Input a price. Type 1 to quit. 58.12 Input a price. Type 1 to quit. 59.3 Input a price. Type1 to quit. 57.2 Input a price Type l to quit 56.7 Input a price. Type -1 to quit. 60.54 Input a price. Type 1 to quit. 57 Input a price. Type1 to quit. The name of the company is Microsoft Day 5 had the highest percent change. Its percent change was 6.77249 The price of the stock on this day closed at 60.54 Press any key to continue

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

Intelligent Information And Database Systems Asian Conference Aciids 2012 Kaohsiung Taiwan March 19 21 2012 Proceedings Part 3 Lnai 7198

Authors: Jeng-Shyang Pan ,Shyi-Ming Chen ,Ngoc-Thanh Nguyen

2012th Edition

3642284922, 978-3642284922

More Books

Students also viewed these Databases questions