联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp

您当前位置:首页 >> C/C++编程C/C++编程

日期:2023-12-18 08:42

C Programming Language

Contribution to module (weighting: 50 %)

1st Semester 2023-2024

Out: FRI. 1th Dec. 2023 Due: FRI. 22nd Dec. 2023

Main objective of the assignment:

Understand C programming and practice to draw a flow chAug. to describe

the problem and coding in C.

You are given a struct product, Table-1 and Table-2 as listed below. You are

required to finish the assignment with given information.

- Write a report;

- Use a flow chAug. or another method, demonstrate the data flow;

- Explain how the structure/functions to be used;

- Program in C language;

- Output screenshot for each question;

1. You are required to finish struct product class[] = {} using Table-1.

struct product

{

int prono;

char fullname[20]

float price;

struct salelist;

};

Table-1. Product’ Record (Given as a file “product.txt”)

prono fullname price

101 mango 3.5

102 orange 2.4

103 banana 2.8

104 watermelon 3.7

105 pineapple 4.1

106 blueberry 5.0

107 cherry 5.5

108 cucumber 1.9

109 cabbage 2.0

110 broccoli 3.1

111 celery 1.9

112 pea 4.5

113 product name product price

*You are requested to modify the last record with any kind of product in the

supermarket, keep prono and price.

2. Sort the records based on price. You are required to write an

appropriate callback function, and output withoutsale list information

on screen.

3. Sale list can be accessed from Table-2. First, you need to sort product’s

records based on month. Then, write an appropriate callback function,

and output with sale list information on screen.

Table-2. Sale list Information (Given as a file “salelist.txt”)

pro no month sales volume discount

101 Sep. 41 10% off

101 Oct. 48 none

102 Nov. 50 10% off

103 Aug. 43 10% off

103 Sep. 56 none

104 Nov. 64 20% off

105 Sep. 71 none

105 Nov. 63 10% off

105 Dec. 33 10% off

106 Sep. 88 10% off

106 Aug. 78 none

106 Physics 91 none

106 Nov. 65 20% off

106 Dec. 82 10% off

107 Nov. 86 10% off

107 Dec. 48 none

107 Dec. 41 none

108 Sep. 38 none

108 Dec. 56 20% off

108 Nov. 58 none

108 Nov. 98 10% off

109 Aug. 63 10% off

110 Sep. 73 10% off

110 Nov. 43 none

110 Dec. 80 none

110 Dec. 65 20% off

111 Sep. 95 20% off

111 Nov. 89 none

111 Oct. 96 none

112 Sep. 36 none

112 Nov. 73 10% off

112 Oct. 21 none

4. Calculate the total sale volume and average sale volume of each

product respectively, and output the them on screen.

5. Output all sales data of September with product information, write the

result to a new txt file and name the file with your Brunel id.

6. Calculate the total sale of each product, and output the top three on

the screen. To achieve this, you need to know that price of each

product varies according to discount of each month. For example: the

price of mango in September has a discount of 10% off. In other words,

the price of mango in September is 3.15. The total sale of mango in

September equals the total sale volume of mango in September

multiple the price of mango in September. Finally, we can get the total

sale of mango by adding up the sales of mango in September,

October,November and December.

7. Write a flow chAug. for each function.

Remarks:

* Solutions to all questions above need to be included one *.c file. In addition,

you are required to define a function for each question. e.g.:

main(), Q1_functionname(), Q2_functionname(), Q3_functionname(),

Q4_functionname() and Q5_functionname(). Qx_functionname() should be

given by yourself.

* The output for each question should be done in main() function.

* Do not include any Chinese characters in your assignment.

* You are required to write annotation before each function, and

annotation / description for important statements. e.g.:

/?

@function function_name

@desc describe what is this function used for.

?/


* The assignment should be submitted in a .doc/.docx or pdf file, all the

source code should be included, and output screenshot should be included.


相关文章

版权所有:编程辅导网 2021 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp