nswer aspa.!

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Answer aspa.! 

Based on the partial C code and the output of the execution as shown below, answer the
a) Write structure definition for struct Stock that consists of:
• grade (of type character)
• price (of type floating point)
following.
#include <stdio.h>
b) Provide function definition for update_Stock that accepts the following as function
// Structure definition for struct Stock
arguments:
• point (a pointer of type struct Stock)
// Function definition for update_Stock
grade (character)
price (floating point number)
// Function definition for display
This function initializes data member where point is pointing to, based on the grade and
price provided in the arguments. The function will not return anything.
int main () {
//Declare and initialize variables shell and esso based on Table 4.1
//Assign new values for variables shell and esso based on Table 4.2
and using function update_Stock
c) Provide function definition for display that will take in a variable of type struct
Stock as argument. This function will output content of all the data members of struct
Stock (argument) on monitor. This function will not return anything.
printf ("For shell:\n");
display (shell);
Tips: Refer to Figure 4.1 for precise output.
printf ("\nFor esso:\n");
display (esso);
d) Declare in main () two variables, namely shell and esso of type struck Stock and
initialize it with the values given in Table 4.1.
Table 4.1
return 0;
Name of variable
Grade
Price
shell
28.10
esso
D
18.50
For shell:
The grade is A
The price is 128.50
e) Initialize variables shell and esso based on the values given in Table 4.2 by calling
function update_Stock ONLY.
Tips: You need to call function update_Stock twice
For esso:
The grade is B
The price is 55.80
Table 4.2
Name of variable
Grade
Price
shell
A
128.50
esso
B
55.80
Figure 4.1
Transcribed Image Text:Based on the partial C code and the output of the execution as shown below, answer the a) Write structure definition for struct Stock that consists of: • grade (of type character) • price (of type floating point) following. #include <stdio.h> b) Provide function definition for update_Stock that accepts the following as function // Structure definition for struct Stock arguments: • point (a pointer of type struct Stock) // Function definition for update_Stock grade (character) price (floating point number) // Function definition for display This function initializes data member where point is pointing to, based on the grade and price provided in the arguments. The function will not return anything. int main () { //Declare and initialize variables shell and esso based on Table 4.1 //Assign new values for variables shell and esso based on Table 4.2 and using function update_Stock c) Provide function definition for display that will take in a variable of type struct Stock as argument. This function will output content of all the data members of struct Stock (argument) on monitor. This function will not return anything. printf ("For shell:\n"); display (shell); Tips: Refer to Figure 4.1 for precise output. printf ("\nFor esso:\n"); display (esso); d) Declare in main () two variables, namely shell and esso of type struck Stock and initialize it with the values given in Table 4.1. Table 4.1 return 0; Name of variable Grade Price shell 28.10 esso D 18.50 For shell: The grade is A The price is 128.50 e) Initialize variables shell and esso based on the values given in Table 4.2 by calling function update_Stock ONLY. Tips: You need to call function update_Stock twice For esso: The grade is B The price is 55.80 Table 4.2 Name of variable Grade Price shell A 128.50 esso B 55.80 Figure 4.1
Expert Solution
steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY