联系方式

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

您当前位置:首页 >> javajava

日期:2020-11-11 11:36

School of Engineering

Computing for Engineers – Assessed Lab 1 (2 hours)

09-10 November 2020 (Week 7 Semester 1)

This is an assessed lab exercise.

Statement of good academic conduct

By submitting this assignment, I understand that I am agreeing to the following statement of

good academic conduct.

I confirm that this assignment is my own work and I have not worked with others in

answering the exercises in this assignment.

I confirm that I have not asked, or paid, others to undertake any part of this work for me.

I confirm that I have read and understood the University regulations on plagiarism

https://intranet.birmingham.ac.uk/as/registry/policy/conduct/plagiarism/index.aspx.

I understand that if concerns are raised about my work I may need to participate in a viva

(oral examination) of my work. I also understand that my progress and/or graduation may be

delayed whilst these concerns are investigated under the Code of Practice on Academic

Integrity or Code of Practice on Plagiarism.

Your C Source code for Exercise A and Exercise B must be uploaded to Canvas by

Tuesday 10 November, 23:59 UK Time

Your code must be uploaded as a .c or .cpp file (C Source file).

In most cases you will need to upload the two files called “main.c” (one for each exercise).

Do not upload .docx files, .pdf or any other format.

Do not email the code to the course lecturer or to any other member of staff or PGTA.

Only Canvas submissions will be marked.

If you have any problems uploading your code, consult the Module Lecturer at least 12

hours before the above deadline. Once the deadline has expired, your mark for the

Assessment will be deducted 5 marks per day or part of a day.

The Module Lecturer cannot extend any deadlines for this assignment for any reason. If you

wish to be considered for an extension, you will need to apply for Extenuating Circumstances

via Engineering Welfare.

Assessed lab exercises

A. A chemical solution contains a mixture of Hydrogen ions and Hydroxide ions.

The acidity of a chemical solution (referred to as “PH”) is dependent on the concentration of

Hydrogen ions m and can be expressed as:

PH = ? log10 (m)

where log10 is the logarithm to base 10 (note the negative sign in front of the log10). The

alkalinity of the same solution (referred to as “POH”) can be expressed as:

POH = ? log10(

1

??×1014)

Again note the negative sign in front of the log10.

Write a program to enter m from the user in exponential notation.

? The program should display the acidity and alkalinity in decimal notation.

? If m is greater than 1.000 or m is less than 10-14, then the acidity and alkalinity should

not be calculated, and an error message should be displayed.

? The program should print out the acidity and alkalinity. Your program should also

print out the sum of the acidity and alkalinity, as a check this should always be equal

to 14.0000.

? The program should also display the following output depending on the value of PH

0 to 6.9 "Acid”

6.9 to 7.1 “Neutral”

7.1 to 14 “Alkaline”

? When using scanf, credit will only be given for using the correct ANSI C input

formats as defined in the Study Guide.

Hint:

? Use the “log10” library function to work out logarithms to base 10.

B. Steel bolts are being measured for quality control purposes. The bolts have a nominal

length of 50mm and diameter of 12mm.

The user of the program enters the required tolerance in mm, and then the user enters the

actual lengths and diameters of a number of bolts which have been measured for quality

control purposes.

The user enters any negative number to terminate the input.

For example, if a tolerance of 2.5mm is entered, that means the length of each bolt must be

within (or equal to) the range 47.5mm to 52.5mm, and the diameter must be within (or equal

to) the range 9.5mm to 14.5mm. These bolts are “Within Tolerance”. If either the length or

diameter is outside these ranges, then the bolt is “Not within Tolerance”.

The program should then display:

? The number of bolts which were “Within Tolerance”

? The percentage of bolts which were “Within Tolerance”

? The average length and the average diameter of all bolts (excluding bolts with any

negative values)

Enter the tolerance

2.5

Enter bolt length/diameter values (enter negative numbers to exit)

52 11

Within tolerance

50 12

Within tolerance

50 12

Within tolerance

53 11

Not within tolerance

52 14

Within tolerance

50 13

Within tolerance

-1 -1

5 bolts were within tolerance

Percentage of bolts within tolerance = 83.333333

Average length of bolt = 51.166667

Average diameter of bolt = 12.166667

END OF THE ASSESSMENT


版权所有:留学生程序网 2020 All Rights Reserved 联系方式:QQ:99515681 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。