Difference between revisions of "CSC111 Homework 4 2015"

From dftwiki3
Jump to: navigation, search
(Problem #1)
(Problem #2)
Line 20: Line 20:
 
;:Example
 
;:Example
  
:::<tt>First name? <u>Allie</u></tt>
+
&nbsp;&nbsp;&nbsp;&nbsp;First name? <u>Allie</u>  
:::<tt>Last name? <u>BABA</u></tt>
+
&nbsp;&nbsp;&nbsp;&nbsp;Last name? <u>BABA</u>  
:::<tt>Your computer account name is: ababazzz</tt>
+
&nbsp;&nbsp;&nbsp;&nbsp;Your computer account name is: ababazzz  
  
:::<tt>First name? <u>Al</u></tt>
+
&nbsp;&nbsp;&nbsp;&nbsp;First name? <u>Al</u>  
:::<tt>Last name? <u>Gus</u></tt>
+
&nbsp;&nbsp;&nbsp;&nbsp;Last name? <u>Gus</u>  
:::<tt>Your computer account name is:aguszzzz</tt>
+
&nbsp;&nbsp;&nbsp;&nbsp;Your computer account name is:aguszzzz  
  
:::<tt>First name? <u>Alma</u></tt>
+
&nbsp;&nbsp;&nbsp;&nbsp;First name? <u>Alma</u>  
:::<tt>Last name? <u>Verylongname</u></tt>
+
&nbsp;&nbsp;&nbsp;&nbsp;Last name? <u>Verylongname</u>  
:::<tt>Your computer account name is: averylon</tt>
+
&nbsp;&nbsp;&nbsp;&nbsp;Your computer account name is: averylon  
 
<br />
 
<br />
 
* Submit your program to HW 4 PB 2 on Moodle.
 
* Submit your program to HW 4 PB 2 on Moodle.
 
<br />
 
<br />

Revision as of 15:26, 15 February 2015

--D. Thiebaut (talk) 15:23, 15 February 2015 (EST)


Problem #1


Write a program that prompts the user for her first and last name, and outputs a computer account made of the first initial of her first name, plus her last name, all in lowercase.

Example
    First name? Allie
    Last name? BABA
    Your computer account name is: ababa 


  • Submit your program to HW 4 PB 1 on Moodle.


Problem #2


Write a program that prompts the user for her first and last name, and outputs a computer account made of the first initial of her first name, plus her last name, all in lowercase. But now we want the computer account to be exactly 8 characters long. If the user names are too short, your program will pad the character 'z'.

Example
    First name? Allie 
    Last name? BABA 
    Your computer account name is: ababazzz 
    First name? Al 
    Last name? Gus 
    Your computer account name is:aguszzzz 
    First name? Alma 
    Last name? Verylongname 
    Your computer account name is: averylon 


  • Submit your program to HW 4 PB 2 on Moodle.