Programming style: Pay attention to issues of programming style:
Work individually, and call me if you need help. You are encouraged to discuss ideas and techniques broadly with other class members, but not specifics. Discussions should be limited to questions that can be asked and answered without using any written medium (e.g. pencil and paper or email). You should at no point look at the screen of your colleagues.
Write a Java program that asks the user if he/she likes Java programming. If the user answers yes, then it displays a congratulating message (use your imagination), and terminates.
Now, if the user answers no, then the fun starts. The program should ask Are you sure you don't like Java programming?. If the user answers no, then it should display Hope you'll get to like it soon.. Otherwise, if the user answers yes, it should ask Are you really sure you don't like Java programming?, and repeat. If the user keeps saying yes, then the program keeps asking Are you really really sure you don't like Java programming?, then Are you really really really sure you don't like Java programming?. And so on, every time printing one more really.
This should stop when it reaches the point when it prints really 5 times. At that point, if the user still answers yes, it should print Too bad, and terminate.
Do you like Java programming? [y/n]: n Are you sure you don't like Java programming? [y/n]: y Are you really sure you don't like Java programming? [y/n]: y Are you really really sure you don't like Java programming? [y/n]: n Hope you'll get to olike it soon..
Do you like Java programming? [y/n]: n Are you sure you don't like Java programming? [y/n]: y Are you really sure you don't like Java programming? [y/n]: y Are you really really sure you don't like Java programming? [y/n]: y Are you really really really sure you don't like Java programming? [y/n]: y Are you really really really really sure you don't like Java programming? [y/n]: y Are you really really really really really sure you don't like Java programming? [y/n]: y Too bad..
Imagine that by 2008 you have become a succesful Bowdoin CS graduate. One the many job offers you have is to work for Dumbbell Corporation, in charge of programming the voting machine that is suppposed to count votes in the next US presidential election. For the sake of this problem, despite the voting machine controversy, let's imagine you take the job.
(a) Your assignment is to write the algorithm that counts the number of votes and decides the president. To do this, you will have to read a list of votes, one by one, from the voting machine. Each vote will represent the selection of one person voting in the booth. A valid vote can be one of two names, "Tom" and "Jerry" (no connection with reality, this is just an exercise); any other name is considered invalid, and discarded. You do not know ahead of time how many people will come to vote. Assume that when the vote day is over and the last person has voted, an appointed officer comes in and sends the vote "AleaIactaEst". Thus your program should read in votes from the machine, one at a time, until reading the vote "AleaIactaEst", which marks the end.
For the sake of this problem assume that Dumbell has forbidden you from counterfeiting votes.
After reading the votes, your program should display the following information:
E-mail me the two java programs, both in the same email. Also, hand in a hard copy of the two Java programs, and the short essay.
Due date: Technically Monday March 6th. Practically, Wednesday March 1st (i.e. in place of exam preparation).