Difference: Lab1-2 (1 vs. 9)

Revision 92018-01-16 - JimSkon

Line: 1 to 1
 
META TOPICPARENT name="WebHome"

Lab 1-2

Changed:
<
<

Due Sept 12, 11:59pm

>
>

Due Feb 6, 11:59pm

 
Changed:
<
<
Moodle Link
>
>
Moodle Link
 
numbers18.jpg

Requirements:

Revision 82017-08-24 - JimSkon

Line: 1 to 1
 
META TOPICPARENT name="WebHome"

Lab 1-2

Changed:
<
<

Due Feb 2, 11:59pm

>
>

Due Sept 12, 11:59pm

 
Changed:
<
<
Moodle Link
>
>
Moodle Link
 
numbers18.jpg

Requirements:

Revision 72017-02-01 - JimSkon

Line: 1 to 1
 
META TOPICPARENT name="WebHome"

Lab 1-2

Line: 12 to 12
 Write a C++ program which takes a 4-digit number (integer) as input from the user and prints the number in reverse order. For example, if the number entered is 5678 then the output should be 8765. The program should repeat this until the user decides to quit.

You need to pay attention to the following:

Changed:
<
<
  1. Provide appropriate comments in your code
  2. Use meaningful identifiers
  3. Don't take the input as a sequence of characters. Take it as a single integer. Also, construct the output as a single integer, as opposed to printing it digit by digit.
  4. Your program should give a warning message if the number (value) is not a 4-digit number. For example, 0345 is not considered to be a 4-digit number.
  5. Your program should not be case-sensitive for the user choice i.e. both Q and q are should be acceptable quit.
  6. You may assume that when asked to enter a 4-digit number, the user enters a positive integer (as opposed to other kind of data, such as a character)
  7. When the last digit (units) of the input is 0, the reverse is not a 4-digit number. So it is Ok to report the reverse as a 3-digit number in that case.
Here is a typical dialogue for this program:
>
>
  1. Provide appropriate comments in your code
  2. Use meaningful identifiers
  3. Don't take the input as a sequence of characters. Take it as a single integer. Also, construct the output as a single integer, as opposed to printing it digit by digit.
  4. Your program should give a warning message if the number (value) is not a 4-digit number. For example, 0345 is not considered to be a 4-digit number.
  5. Your program should not be case-sensitive for the user choice i.e. both Q and q are should be acceptable quit.
  6. You may assume that when asked to enter a 4-digit number, the user enters a positive integer (as opposed to other kind of data, such as a character)
  7. When the last digit (units) of the input is 0, the reverse is not a 4-digit number. So it is Ok to report the reverse as a 3-digit number in that case.
Here is a typical dialogue for this program:
 
Input a 4 digit Number to Reverse and press Enter: 452
This is not a 4-digit number:452

Line: 40 to 39
 
  • When integers are divided, the result of the / operator is the algebraic quotient with any fractional part discarded. For example: x = 11 / 3; results in x = 3.
  • If the number entered is n, what does n%10 give you? How about n/10?
Deleted:
<
<

Grading

Feature %
Program correctness and completeness with respect to definition 70%
Code Format (Indenting, variable names) 10%
Code Comments 10%
A document showing all complete run outputs for the test cases given. 10%
 

Turn in

  • The code (as a cpp file),
  • A file with the collected outputs from the trial inputs below the run outputs as requested below.

Revision 62017-01-17 - JimSkon

Line: 1 to 1
 
META TOPICPARENT name="WebHome"
Added:
>
>
 

Lab 1-2

Changed:
<
<

Due Sept 13, 11:59pm

>
>

Due Feb 2, 11:59pm

 
Changed:
<
<
Moodle Link

Requirements:

>
>
Moodle Link

numbers18.jpg

Requirements:

  Write a C++ program which takes a 4-digit number (integer) as input from the user and prints the number in reverse order. For example, if the number entered is 5678 then the output should be 8765. The program should repeat this until the user decides to quit.
Line: 75 to 78
 
Document wth trial runs included   10  
Total   100  
Solution \ No newline at end of file
Added:
>
>
  • numbers18.jpg:

META FILEATTACHMENT attachment="numbers18.jpg" attr="" comment="" date="1484622030" name="numbers18.jpg" path="numbers18.jpg" size="71913" user="JimSkon" version="1"

Revision 52016-09-06 - JimSkon

Line: 1 to 1
 
META TOPICPARENT name="WebHome"

Lab 1-2

Due Sept 13, 11:59pm

Line: 49 to 50
 
  • A file with the collected outputs from the trial inputs below the run outputs as requested below.

Coding Requirements:

Changed:
<
<
  1. Follow follow the guidelines on Program Style described in section 2.5 of the textbook. ( See guidelines here).
>
>
  1. Follow the guidelines on Program Style described in section 2.5 of the textbook. ( See guidelines here).
 

Test Cases

Revision 42016-09-06 - JimSkon

Line: 1 to 1
 
META TOPICPARENT name="WebHome"

Lab 1-2

Due Sept 13, 11:59pm

Added:
>
>
Moodle Link
 

Requirements:

Write a C++ program which takes a 4-digit number (integer) as input from the user and prints the number in reverse order. For example, if the number entered is 5678 then the output should be 8765. The program should repeat this until the user decides to quit.

Line: 18 to 20
 
Input a 4 digit Number to Reverse and press Enter: 452
This is not a 4-digit number:452

Added:
>
>
Input a 4 digit Number to Reverse and press Enter: 56789 This is not a 4-digit number:56789
 Input a 4 digit Number to Reverse and press Enter: 1432
Changed:
<
<
New Reversed Number is: 1432
>
>
New Reversed Number is: 2341
 Enter Q to quit, enter any letter to continue n
Changed:
<
<
Input a 4 digit Number to Reverse and press Enter: 5234
>
>
Input a 4 digit Number to Reverse and press Enter: 4325
 New Reversed Number is: 5234 Enter Q to quit, enter any letter to continue Q Thanks for playing!
Line: 31 to 35
 
  • The integer % operator gives the remainder of a division of two values. For example: x = 11 % 3; results in x = 2;
  • When integers are divided, the result of the / operator is the algebraic quotient with any fractional part discarded. For example: x = 11 / 3; results in x = 3.
  • If the number entered is n, what does n%10 give you? How about n/10?
\ No newline at end of file
Added:
>
>

Grading

Feature %
Program correctness and completeness with respect to definition 70%
Code Format (Indenting, variable names) 10%
Code Comments 10%
A document showing all complete run outputs for the test cases given. 10%

Turn in

  • The code (as a cpp file),
  • A file with the collected outputs from the trial inputs below the run outputs as requested below.

Coding Requirements:

  1. Follow follow the guidelines on Program Style described in section 2.5 of the textbook. ( See guidelines here).

Test Cases

Run the program for the following data, turning in a document will all run data (as a Word, text or pdf document)

Trial Input number
1 1554
2 16778
3 53
4 4856
5 9137

Grading Table

Requirement Grading Comments Points Score
Correct output on required trial data   50  
Good clean, easy to understand Input and output operations   10  
Complete source code   10  
Appropriate code formatting (indenting, whitespace)   5  
Good identifier names   5  
Description Comments on top   5  
Section comments throughout   5  
Document wth trial runs included   10  
Total   100  
Solution

Revision 32016-09-05 - JimSkon

Line: 1 to 1
 
META TOPICPARENT name="WebHome"

Lab 1-2

Due Sept 13, 11:59pm

Line: 15 to 15
 
  1. You may assume that when asked to enter a 4-digit number, the user enters a positive integer (as opposed to other kind of data, such as a character)
  2. When the last digit (units) of the input is 0, the reverse is not a 4-digit number. So it is Ok to report the reverse as a 3-digit number in that case.
Here is a typical dialogue for this program:
Deleted:
<
<
 

Changed:
<
<
Enter a 4-digit number 134 This is not a 4-digit number: Enter a 4-digit number 1234 The reverse number is 4321 Enter Q to quit, enter any letter to continue C Enter a 4-digit number 9001 The reverse number is 1009 Enter Q to quit, enter any letter to continue Q Thanks for using this program, bye !...
>
>
Input a 4 digit Number to Reverse and press Enter: 452 This is not a 4-digit number:452 Input a 4 digit Number to Reverse and press Enter: 1432 New Reversed Number is: 1432 Enter Q to quit, enter any letter to continue n Input a 4 digit Number to Reverse and press Enter: 5234 New Reversed Number is: 5234 Enter Q to quit, enter any letter to continue Q Thanks for playing!
 

Important hint

Revision 22016-08-24 - JimSkon

Line: 1 to 1
 
META TOPICPARENT name="WebHome"

Lab 1-2

Changed:
<
<

Due Sept 15, 11:59pm

>
>

Due Sept 13, 11:59pm

 

Requirements:

Write a C++ program which takes a 4-digit number (integer) as input from the user and prints the number in reverse order. For example, if the number entered is 5678 then the output should be 8765. The program should repeat this until the user decides to quit.

Revision 12015-09-07 - JimSkon

Line: 1 to 1
Added:
>
>
META TOPICPARENT name="WebHome"

Lab 1-2

Due Sept 15, 11:59pm

Requirements:

Write a C++ program which takes a 4-digit number (integer) as input from the user and prints the number in reverse order. For example, if the number entered is 5678 then the output should be 8765. The program should repeat this until the user decides to quit.

You need to pay attention to the following:

  1. Provide appropriate comments in your code
  2. Use meaningful identifiers
  3. Don't take the input as a sequence of characters. Take it as a single integer. Also, construct the output as a single integer, as opposed to printing it digit by digit.
  4. Your program should give a warning message if the number (value) is not a 4-digit number. For example, 0345 is not considered to be a 4-digit number.
  5. Your program should not be case-sensitive for the user choice i.e. both Q and q are should be acceptable quit.
  6. You may assume that when asked to enter a 4-digit number, the user enters a positive integer (as opposed to other kind of data, such as a character)
  7. When the last digit (units) of the input is 0, the reverse is not a 4-digit number. So it is Ok to report the reverse as a 3-digit number in that case.
Here is a typical dialogue for this program:
Enter a 4-digit number
134 
This is not a 4-digit number: Enter a 4-digit number 
1234 
The reverse number is 4321 
Enter Q to quit, enter any letter to continue  C 
Enter a 4-digit number 
9001 
The reverse number is 1009 
Enter Q to quit, enter any letter to continue 
Q 
Thanks for using this program, bye !...

Important hint

  • The integer % operator gives the remainder of a division of two values. For example: x = 11 % 3; results in x = 2;
  • When integers are divided, the result of the / operator is the algebraic quotient with any fractional part discarded. For example: x = 11 / 3; results in x = 3.
  • If the number entered is n, what does n%10 give you? How about n/10?
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback