Due Date: midnight, Friday, 23 November.

This assignment focuses on nested loops and indefinite loops from Chapter 8.

Submit the following programs via Blackboard:

  1. Write a program that asks the user to guess a secret number. If they guess too high, you should print out a message saying that and let them guess again. If they guess too low, you should print out a message saying that and them them guess again. When they guess correctly, you should thank them for playing, and the program ends.

  2. Write a program that asks the user to enter a number between 1900 and 2012. If they enter a number out of range, print a message that the number is out of range and prompt them again for a number between 1900 and 2012. When the user enters a number in range, print the number to the screen and end the program.

  3. Write a program that asks the user to enter an integer (for example, 12345678). The program sums the digits of the integer (in this example it gets 36). It then sums the digits of that integer (in the example, it gets 9). It keeps going until it is down to a one-digit number, which it prints.

  4. Write a program that asks the users to enter a sequence of amounts to credit or debit to their account. Your program should continue to process their amounts as long as their balance is positive. If at any point they have a negative balance, print a message and end the program. If you are able to process all the amounts, print the final balance to the screen before ending the program. You may assume that their beginning balance is $1000.

    One sample run of the program:

    	    Please enter the amounts to credit/debit from your account, separated by commas:  -500,100.01,-1000,333.33,85.02,-200
    
    	    Beginning Balance:  $1000.00
    	      
    	    Amount: -500.00
    	    Balance: $ 500.00
    	    Amount: 100.01
    	    Balance: $ 600.01
    	    Amount: -1000.00
    	      
    	    Your balance has dropped below 0!  Please contact the bank immediately!
             

    Another sample run of the program:

    	    Please enter the amounts to credit/debit from your account, separated by commas:  5.00,123.01,-600,7.89,-99.99
    	    
    	    Beginning Balance:  $1000.00
    	    
    	    Amount:  5.00
    	    Balance: $1005.00
    	    Amount:  123.01
    	    Balance: $ 1128.01
    	    Amount: -600
    	    Balance: $ 528.01
    	    Amount: 7.89
    	    Balance: $ 535.90
    	    Amount: -99.99
    	    Balance: $ 435.91
    	    
    	    Your final balance is:  $ 435.91
    	 

  5. Write a program that reads in a text file, infile.txt, and prints out all the lines in the file to the screen until it encounters an empty line. Once it finds an empty line, the program stops.
For more information on using Blackboard, see the first lab.

General Notes