Assignment title: Information


This question is based on contents covered in Chapter 1 to 3 of text. The objectives of the question is to assess students’ on their  setting up of the machine and running with the software and Course Team files correctly installed, if any.  ability to declare variables with the suitable data type.  understanding of selection construct and repetition construct (a) The purpose of this part of the question is to ensure that you have installed MS Visual C++ Express Edition and to get you familiar with the steps in writing, compiling and running a C++ program using the installed software. (i) After you have installed MS Visual C++ Express Edition and registration on your machine, you are ready for the next step. (ii) Create a new empty project. Please refer to . Name this cpp code file as ABCQ1a.cpp where ABC denotes the initials of your name. (iv) Copy and paste the following code to this empty source code file. #include #include using namespace std; int main() { int m = 8; // Line 1 float k = 2.5; // Line 2 double j = 22/7; // Line 3 cout << "(a) " << m << " "; cout << "(b) " << m++ << "\n"; // Line 4 cout << "(c) " << --k << endl; // Line 5 cout << "(d) " << (k + 1) << "\n\n" ; cout << "(e) " << 1 + m << endl << endl; cout << "(f) " << k << endl; cout << fixed << setprecision(2) // Line 6 << "(h) " << j << endl; cin.ignore();// this line is optional } Table 1.1 (v) Compile and run the program. (vi) Capture the output screen of the run. You can do this by using the Print Screen facility. Your keyboard should have a key labeled Print Screen or Prt Scr which can capture the contents of the active window. Pressing Alt+Print Screen will copy an image of the active window to the clipboard. (vii) Open MS-Word and then choose Edit|Paste to copy the clipboard contents into the blank document. (5 marks) ICT271 Tutor-Marked Assignment SIM UNIVERSITY Tutor-Marked Assignment – Page 4 of 9 (b) Describe the data types indicated in Line 1 to Line 3 of the program in Table 1.1. (3 marks) (c) Explain the statement in Line 6 of the program in Table 1.1. (3 marks) (d) Study the increment and decrement operator used in Line 4 and Line 5 of the program in Table 1.1. Explain how the line of code works using the respective operator. (3 marks) (e) Demonstrate your ability to use C++ syntax to develop code after examine of the given data in Table 1.2 and requirements. The program which uses a loop to prompt the user to enter the customer ID, sales amount and discount rate, computes and accumulates the net amount if the entered sales amount is more than S$10000. The loop is control via the sentinel value, ‘E’. At the end of the loop, the program displays the total net amount with 2 decimal places. See sample output. The net amount of each customer is computed using the following formula: Net amount = (1-Discount Rate/100) * Sales Amount