201: Lab A
1. Download Eclipse onto your computer
2. Please follow this link if you are having trouble in installing Eclipse.
https://www.youtube.com/watch?v=TXbuATMlVNY&index=19&list=PL_v5Vo_UXw
aHWOr2I9dq7DxI6Iw3eQzOd
3. Sample code
#include
<iostream>
using
namespace
std;
int
main
()
{
cout << "Hello world\n";
return
0;
}
Problem 2-1:
Write a program that ask the user for the flowing:
How many shares to be bought:
The price per share:
Percent commission for the broker for each transaction:
Average annual return as of percentage:
The program should calculate and display the following:
The amount paid for the stock alone (without the commission)
The amount of the commission
The total amount of paid (the payment for stock plus the commission)
After TEN years, your shares will worth
:
Name your project as
LabA
and save your program (source code) as
LabA.cpp
.
Lab Deliverables:
1.upload your source code (.cpp file) onto Canvas LabA folder before the due time.
2. Upload the word file named CMPSC201_LabA_LASTNAME.
Have results for three test cases and past them under comment section of Canvas:
# of Shares
Price/share
Percentage for commission
Average annual return as of percentage:
450
180
2
4%
700
23
2
5%
5
1200
2
10%
//please find the code below
#include <iostream>
#include<stdio.h>
using namespace std;
//function to calculate the amount of stocks alone
long int stockAmount(int num_shares, int priceOfShare){
return num_shares*priceOfShare;
}
//function to calculate commission amount
double calculateCommission(long int amount, int
commissionPercentage){
return amount*commissionPercentage/100.0;
}
//function to calculate total amount
double calculateTotalAmount(long int amount, double
commissionAmount){
return amount+commissionAmount;
}
//function to calculate stocks worth after 10 years
double stocksWorth(long int amount, int percentageReturn){
int years=10;
float percentage=percentageReturn/100.0;
double stocksAmount=amount;
//Loop 10 times to increase stock worth accordingly every
year
for(int i=0;i<years;i++){
stocksAmount=stocksAmount+stocksAmount*percentage;
}
}
int main() {
int
num_shares,priceOfShare,commissionPercentage,percentageReturn;
cin>>num_shares>>priceOfShare>>commissionPercentage>>percentageReturn;
//calling the required functions to calculate the
required values
long int
amount=stockAmount(num_shares,priceOfShare);
double
commission=calculateCommission(amount,commissionPercentage);
double
totalAmount=calculateTotalAmount(amount,commission);
double
finalStocksWorth=stocksWorth(amount,percentageReturn);
//printing the calculated values
cout << "The amount paid for the stock alone
(without the commission) is "<<amount<<endl;
cout << "The amount of the commission is
"<<commission<<endl;
cout << "The total amount of paid (the payment
for stock plus the commission) is
"<<totalAmount<<endl;
cout << "After TEN years, your shares will worth
"<<finalStocksWorth<<endl;
return 0;
}
------------------------------------------------------------------------------------------------------------------------------------------
Input 1:
450
180
2
4%
Output 1:
Input 2:
700
23
2
5%
Output 2:
Input 3:
5
1200
2
10%
Output 3:
201: Lab A 1. Download Eclipse onto your computer 2. Please follow this link if you are having trouble in installing Ecl...
Can you please upload the video to step by step with eclipse and mysql workbench.please................................ Part 1 Design the database using the ER approach. Then using Java and SQL, implement the following functionality: 1. Implement a button called “Initialize Database” . When a user clicks it, all necessary tables will be created (or recreated) automatically, with each table be populated with at least 10 tuples so that each query below will return some results. All students should use the database...
Can you please upload the video to step by step with eclipse and mysql workbench.please................................ Part 1 Design the database using the ER approach. Then using Java and SQL, implement the following functionality: 1. Implement a button called “Initialize Database” . When a user clicks it, all necessary tables will be created (or recreated) automatically, with each table be populated with at least 10 tuples so that each query below will return some results. All students should use the database...
Im having trouble with this C++ program. Lab 10/object/test files provided LAB 10 1 //Savings.cpp - displays the account balance at 2 //the end of 1 through 3 years 3 //Created/revised by <your name> on <current date> 4 5 #include <iostream> 6 #include <iomanip> 7 #include <cmath> 8 using namespace std; 9 10 //function prototype 11 double getBalance(int amount, double rate, int y); 12 13 int main() 14 { 15 int deposit = 0; 16 double interestRate = 0.0; 17...
Use C++ For this week’s lab you will write a program to read a data file containing numerical values, one per line. The program should compute average of the numbers and also find the smallest and the largest value in the file. You may assume that the data file will have EXACTLY 100 integer values in it. Process all the values out of the data file. Show the average, smallest, largest, and the name of the data file in the...
18.1 Lab Lesson 11 (Part 1 of 1) Part of lab lesson 11 There in one part to lab lesson 11. The entire lab will be worth 100 points. Lab lesson 11 part 1 is worth 100 points For part 1 you will have 80 points if you enter the program and successfully run the program tests. An additional 20 points will be based on the style and formatting of your C++ code. Style points The 20 points for coding...
in c++ please Page 1 of 3 (PRO) Project Assignment Instructions Last Charged: 6/1/2020 Read and follow the directions below carefully and perform the steps in the order listed. You will be solving one program as instructed and turning in your work electronically via an uploaded file within Eagle Online/Canvas and copy & paste the program to the Text Entry box as well. Make sure and check your work prior to uploading the assignment (NOTE: For Steps 1 & 2...
please follow the instruction ( very important ) 1912275-dt content-rid 43901523 1/courses/CSct A31. (25 pts) You must use a tor loop in the following program Write, compile, debug, and run a program that will use a for loop to do the following Some investments compound interest. This means that the interest is added onto the balance periodically during the year, and the next interest is calculated on this larger balance. This makes the actual return on investment actually greater than...
Programming Assignment #2 EE 2372 MAKE SURE TO FOLLOW INSTRUCTIONS CAREFULLY, IF YOU HAVE ANY DOUBTS PLEASE EMAIL ME! This programming assignment will just be a small extension to programming assignment 1. In the first assignment each of the functions could only take a predefined number of inputs. This time the objective is to be able to complete these functions with any amount of inputs. The user will pass arguments through the command line (this means you will have to...
could you please help me with this problem, also I need a little text so I can understand how you solved the problem? import java.io.File; import java.util.Scanner; /** * This program lists the files in a directory specified by * the user. The user is asked to type in a directory name. * If the name entered by the user is not a directory, a * message is printed and the program ends. */ public class DirectoryList { public static...
For this assignment you will be creating a multi-file project in which you implement your own templated linked list and use it to create a simple list of composers. When doing this assignment, take small, incremental steps; trying to complete the lab in one go will make the lab more difficult. This means that any time you finish part of the lab, such as a linked list method, you should immediately test and debug it if necessary. Part 1: Creating...