1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Misha Larkins [42]
3 years ago
9

No Loops, or if statements, or arrays allowed for this program. You will receive a zero if your program contains any loop, if st

atement, or array. You need a program to maintain information about your stocks. Assume that you have the following stocks:
Stock Name Number of Shares Buying Price Current Price Yearly Fees
Per Share Per Share
IBM 155 $15.33 $13.33 $5.00
ORACLE 375 $11.77 $12.25 $3.50
SUN MICRO 350 $27.55 $35.75 $12.25
LINKSYS 85 $25.35 $23.34 $6.00
CISCO 50 $45.36 $50.86 $1.50
You must use the data from this table for you Program Set 2 submission.
Write a C program that will perform the following tasks:
Task 1: Allow the user to enter in the data for each stock. Stock name, Number of shares, Buy Price, Current Price and Yearly fees.(The user will not enter the $'s.)
Task 2: Calculate the Initial Cost, Current Cost, and Profit for each stock. The formulas to use are: Initial Cost

Computers and Technology
1 answer:
Softa [21]3 years ago
4 0

Answer:

Here is the C program:

#include <stdio.h> //to use input output functions

int main(){ //start of main function

    char *stock_name=NULL; //to store stock name (this is used instead of using char type array)

    int shares; //to store number of shares

    float buy_price; //to store the buy price

    float cur_price; //to store the current price

    float fees; //to store the fees

    double initial_cost; //to store the computed initial cost

    double current_cost; //to store the value of computed current cost

    double profit; //to store the calculated value of profit

printf("enter stock name ");  //prompts to enter stock name

scanf("%m[^\n]",&stock_name); //reads the input stock name

printf("enter number of shares "); //prompts to enter number of shares

scanf("%d", &shares); //reads the input number of shares

printf("enter the buy price, current price and fees "); //prompts to enter buy price, current price and fees values from user

scanf("%f %f %f", &buy_price, &cur_price, &fees); //reads the values of buy price, current price and fees from user

    initial_cost = shares * buy_price; //computes initial cost

    current_cost = shares *cur_price; //computes current cost

    profit = current_cost - initial_cost - fees; //computes profit for each stock

printf("The stock name is: %s\t\n",stock_name); //displays the stock name

printf("The number of shares: \t%d\t\t\n",shares); //displays the number of shares

printf("The buy price is:\t$\t %0.2f\t\n",buy_price); //displays the buy price

printf("The current price is:\t$\t %0.2f\n",cur_price); //displays the current price

printf("The fees are:\t\t$\t %0.2f\n",fees); //displays the fees

printf("The initial cost is:\t$\t %0.2f\n",initial_cost); //displays the computed initial cost

printf("The current cost is:\t$\t %0.2f\n",current_cost); //displays the computed current cost

printf("The profit is:\t\t$\t %0.2f\n",profit);//displays the computed profit for each stock

return 0;  }

       

Explanation:

Lets say the user input IBM, 150, 11.33 13.33 and 5.00 as stock name, number of shares, buy price, current price and fees values.

So,

stock_name = "IBM"

shares = 150

buy_price = 11.33

cur_price = 13.33

fees = 5.00

Now initial cost is computed as:

  initial_cost = shares * buy_price;

This becomes:

  initial_cost = 150* 11.33

  initial_cost = 1699.5

Next current cost is computed as:

    current_cost = shares *cur_price;

This becomes:

    current_cost = 150*13.33

    current_cost = 1999.5

Next the profit is computed as:

    profit = current_cost - initial_cost - fees;

This becomes:

    profit = 1999.5 - 1699.5 - 5.00

     profit =     295

These values are displayed on the output screen up to 2 decimal places. So the output of the entire program is:

The stock name is: IBM                                                                                                                        The number of shares:   150                                                                                                                   The buy price is:         $        11.33                                                                                                        The current price is:   $        13.33                                                                                                        The fees are:               $        5.00                                                                                                         The initial cost is:        $        1699.50                                                                                                      The current cost is:     $        1999.50                                                                                                      The profit is:                 $        295.00

The screenshot of the output is attached.

You might be interested in
What would you enter at the command prompt to start a new bourne again shell session?
butalik [34]

The answer is bash . The bash command opens a Bourne-again sheel (bash) session. It is the standard shell used in most Linux computers and it uses commands similar to a UNIX shell. Bash includes features such as:

1) Command completion when pressing the tab key.

2) Command history.

3) Improved arithmetic functions.

6 0
3 years ago
What type of memory speeds up the action performed by the computer and anticipates instructions?
kherson [118]
A cache memory is a small piece of memory that can be accessed very fast. It keeps copies of data that is used often. For example, by keeping data read from a database in memory, the second time the data is needed, it can be taken from the cache in stead of a lengthy query in the database.

Caches can be found in hardware (ie., on the cpu itself), but also as a programming concept in software.
4 0
3 years ago
To create an SSL connection, a Web server requires a ________, which is an electronic document that confirms the identity of a w
pogonyaev

Answer:

c. SSL Certificate

Explanation:

The full form of SSL is Secure Sockets Layer. It is the standard security technology which establishes the encrypted link between a client and the server—typically a web server (which is the website) and the browser, or the mail server along with a mail client (for e.g., Outlook).

In the context, in order to develop an SSL connection, an SSL Certificate is required by the Web server.

3 0
3 years ago
Why are most minicomputers no longer used​
Svet_ta [14]

Answer:

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Explanation:

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as sma

7 0
4 years ago
What do production designers have to have extensive knowledge of when they are involved in the production of a motion picture?
defon

Answer:

The correct option is;

D. All of the above

Explanation:

The role of a production designer in film and television production involves portraying the generally perception and appearance of the narrative. The production designer is responsible for addressing the viewer perception of the location, the period in time of the narrative about the leading character, the depiction of the acts of the and experiences of the characters and the reason for their acts and experiences.

The production designer have an essential role in movie production and television programming and they work first hand with the motion picture cinematographer, director and producer.

6 0
3 years ago
Other questions:
  • While trying to solve a network issue, a technician made multiple changes to the current router configuration file. The changes
    7·1 answer
  • Toshiba Corporation makes computer chips. Toshiba Corporation would be classified as a A. merchandising company. B. manufacturin
    15·1 answer
  • What Is one reason that more personal computers have windows operating systems as opposed to Mac operating systems
    7·2 answers
  • What are the four elements of game design?<br><br> Help Me!!
    9·1 answer
  • What are QBASIC Operators ?​
    11·2 answers
  • PLEASE READ ( if you want ) Before i used to have over 30 brainliest and i was just trying to earn points so i could get to ace,
    9·1 answer
  • How to unblock a website on a school computer? ASAP who's ever works will get Brainliest and will get a follow.
    14·2 answers
  • What does a wireless LAN (WLAN) act as to a wired network?
    12·1 answer
  • Need help plzz now it's hard ​
    5·1 answer
  • WILL CHOOSE BRAINLIEST! in cells D6 through D8, enter formulas to calculate the values of the stocks. The formulas should multip
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!