UCCD1004
PROGRAMMING CONCEPTS AND PRACTICES ASSIGNMENT 1 DUE DATE
FOR ASSIGNMENT 1: WEEK 6, FRIDAY BEFORE 5.00PM |
1.
EQUIPMENT
Hardware:
The PCs in the lab for conducting your practical.
Software:
The Microsoft Visual Studio 2017. Your programming will be tested by the
markers using Visual Studio 2017.
2.
PROJECT:
This is an INDIVIDUAL assignment. NO help should be obtained from any other persons,
as well as the Internet.
3.
DESCRIPTION OF PROJECT:
The assignment focuses on some
important aspects of structured programming practices. The aim of this
assignment is to provide an opportunity to demonstrate that you have acquired
the skills and ability to be proficient in the area of developing C++
application program using modular approach.
4.
ACADEMIC HONESTY AND COLLABORATION
Cooperation
is recommended ONLY in understanding various concepts and system features. However,
the actual solution of the assignment, the programming and debugging must be
your individual work, except for what you specifically credit to other sources.
(Your grade will be based on your own contribution.) For example, copying
without attribution any part of someone’s program is plagiarism, even if you
modify it and even if the source is a textbook. You can document the credit to
other sources at the start of your program code listing. Offenders will be
awarded with zero mark for this assignment.
5.
PENALTY
Penalties such as downgrade or reduction of marks will be given to empty
or late submissions unless legitimate reasons are provided.
Write a C++ program to
output the value of WITHOUT using any library functions other than iostream, when the input is a positive real number
. You MUST
use (or follow) the pseudocode given
in Section C.
Notation: For any real numbers and
, where
,
is the set of real
numbers which are greater than
, and less than
.
Fact 1: For any positive real number, (1) if
, then
; (2) if
, then
; (3) if
, then
Observations: If , just need to output 1. Else,
is sandwiched by
and
, no matter whether
or
. So, we search
if
, and
if
.
Fact 2: For , suppose that
is located inside
, for some real numbers
, where
. Let the middle point
of
be
, and
. There are three
cases: (1) if
, then
is located inside
; (2) if
, then
is located inside
; and (3) if
, then
.
Observations: When we know that is located in
, we compare
and
. If
, then we are lucky, and can claim
. If
, then the possible range of
will be narrowed down
to either
or
, and the widths of both intervals are half of the original
one
. We now can focus on
either
or
. After repeating the
same steps, the width of the interval concerned will be further halved. This is the basic idea of the whole
assignment. For your interest, in the
literature, this technique is called bisection method.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
23 | 24 | 25 | 26 | 27 | 28 | 1 |
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 | 1 | 2 | 3 | 4 | 5 |
Get Free Quote!
349 Experts Online