Assignment 3 - SU 2020
CSE 1321L: Programming and Problem Solving I LabAssignment 4 – 100 pointsIterationWhat students will learn:Problem solvingUsing loopsUsing logic within loopsNested loops (loops inside of loops)Overview: If there’s one thing that computers do well, it’s repeating things. In fact, most of what your computer does is simply “loop” waiting for some kind of input. For this assignment, you’re going to use loops to solve some basic problems, and we hope you have fun while you’re doing it. The programs aren’t long, but will require you to think critically. Again, start early, practice, and ask a lot of questions.We’ll follow the same conventions for class names and file names as well as the process of combining pseudocode into your source code (e.g. don’t use Word). For the Java folks, remember to remove the “package” statement if you have one. You’ll still receive an extra +5 points if the autograder runs cleanly with your code and output. We’ll also continue to use PRINTLINE() to make it easier to submit to the autograder. Of course, don’t cheat. Note: the autograder for Assignment4C and Assignment4D is super picky, so we’ll give you hints.Assignment4A: Warm-up. Before everyone had a computer of their own, people had to use a terminal, which was basically a monitor and a keyboard that connected to a shared mainframe computer. People would log into their accounts and start working using the command line (all typing, no mouse, no windows). When they got up to take a break, they often forgot to lock their terminal. That’s when people taught them a lesson by writing a simple program that asks for a cookie. And before you laugh away the command line, you need to realize that command-line compiling is a common interview question at Apple…Write a program that continuously asks the user for a cookie and repeats until they type the word cookie. Start with pseudocode and include it in your source code. Call the file Assignment4A(.java, .cs, .cpp) and the class name Assignment4A.Sample Output #1:Gimme a cookie: What?Gimme a cookie: Who is this?Gimme a cookie: asdfGimme a cookie: NoGimme a cookie: cookieLog out next time!Assignment4B: Fiba-what? If you’ve never heard of the Fibonacci series, it’s an infinite series that occurs everywhere in nature. It starts off with two digits – 0 and 1. To get the next value in the series, you add the previous two values. In this case, the third value is 0+1 = 1. The fourth value is 1+1 = 2, the fifth 1+2=3 and so on, to give us a series like:0, 1, 1, 2, 3, 5, 8, 13, 21, 34,…I always wondered what it would look like if you changed the starting values from 0 and 1 to some arbitrary (and if it would matter). We’re going to do that here. Ask the user for a pair of starting values as well as a number of times to iterate the series, then produce the correct output. We recommend you use a FOR loop and use a sum variable.Include pseudocode as comments in your source code. Call the file name Assignment4B(.java, .cs, .cpp) and the class name Assignment4B. When printing the next value in the series, print the comma first. The first two values do not count in the series.Hint: other than the first two numbers, a comma is printed before each number. The first two can be handled before you print the sequence.Sample Output #1:Enter seed 1: 5Enter seed 2: 8Number of iterations: 105,8,13,21,34,55,89,144,233,377,610,987Sample Output #2:Enter seed 1: 56Enter seed 2: 78Number of iterations: 656,78,134,212,346,558,904,1462Assignment4C: Border master. Similar to Assignment4A, “windows” used to be made out of asterisks or “stars” (*). For this assignment, you’re going to “draw” the windows of a square using stars. The top and bottom part of the window will have a space between the stars. The program will ask for a single value, which represents the width and height of the window.Hint for autograder: there is a space printed after every star (*) in the sample output below. Also, the boxes are not “empty”. Those are a series of spaces.Include pseudocode as comments in your source code. Call the file name Assignment4C(.java, .cs, .cpp) and the class name Assignment4C. Sample Output:Width: 7* * * * * * * * * * * * * * * * * * * * * * * *Sample Output #2:Width: 5* * * * * * * * * * * * * * * *Assignment4D: Triangle man, Triangle man. This part of the assignment will use nested loops, meaning a loop inside of another loop. For example, you may have something like:for (int i = 0; i < 5; i++) { for (int j = 0; j < 7; j++) { cout << i*j << " "; } cout << endl;}The inner loop (the ‘j’ loop) would execute 7 times each time the outer loop (the ‘i' loop) executes 1 time. What would this chunk of code do? It would print out a multiplication table with a maximum of 5*7. You need to walk through and understand this code before continuing.To understand what needs to happen for this assignment, we’ll start with sample output:Sample Output:Size: 50 1 2 3 4 0 1 2 3 0 1 2 0 1 0 You can see that we printed 5 lines (total). Each line consists of a certain number of spaces followed by an increasing sequence of numbers. What I would recommend is starting by trying to write the following:Size: 5* * * * * * * * * * * * * * *and then see if you can then work on the correct numbers.So, for this assignment, you will read in a “size” from the user and then print out the appropriate “triangle” of numbers. I might be overstating it a bit, but if you can solve logic problems like this, you’ll probably enjoy programming in general.Sample Output:Size: 30 1 2 0 1 0Sample Output#2:Size: 100 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 0 1 2 3 4 5 0 1 2 3 4 0 1 2 3 0 1 2 0 1 0Hint for the autograder: note, every number has a space after it.Include pseudocode as comments in your source code. Call the file name Assignment4D(.java, .cs, .cpp) and the class name Assignment4D.Submission:You will submit 4 separate files containing source code and pseudocode as comments – one for each of the assignments above. File names and class names must be correct.Upload all 4 files (simultaneously) to the assignment submission folder in Gradescope. Do NOT submit homework in D2L.You will receive two parts of a grade. The autograder will assign the first 60% of the grade. Your pseudocode will be graded for the remaining 40%. Remember, the output of your program must match exactly for the autograder to work.We’ll continue to work with you on this assignment if something messes up, so long as you submit by the due date. However, start early because we work during the weekday. ................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related searches
- 3 year calendar printable 2019 2020 2021
- 2020 ford 7 3 gas engine mpg
- 2020 ford 7 3 gas mpg
- 2020 ford f250 7 3 gas engine mileage
- 2020 ford 7 3 fuel economy
- 2020 ford 7 3 gas engine mpg forum
- 2020 ford f250 7 3 gas engine mpg
- 2020 ford 7 3 gas engine reviews
- node sites default files media er newsletter 3 2020 docx
- 2020 mustang 2 3 turbo road test
- su 35 vs su 27
- su 35 vs su 30