Assignment #4
CSE 1321L: Programming and Problem Solving I Lab
Assignment 5 – 100 points
Methods
Program 0: What are they thinking? One common technique for interviewing computing professionals is by asking bizarre questions. For example, “how many gas stations are there in the United States?” Do they expect you to know the answer? No. They are really trying to see if you can reason your way through providing a ballpark estimate. Another common question is to calculate how much the Washington Monument weighs. FYI, the monument is 555 ft tall and 55 ft wide (and deep). So, for this assignment, we’re going to help people that want to build (and move) their own pyramid monuments! The volume of a pyramid with a square base is calculated as V = A(h/3), where A is the area of the square base and h is the height. Our monuments will be made out of marble, which weigh 169.2 pounds per cubic foot. You must write a function called monumentWeight that takes in the width (in feet) of the base of the monument and its height (in feet). The function should return the weight of the monument. Your task is to design (pseudocode) and implement (source code). For the source code, name your class “A5_0” and put it into a file called “A5_0” (either .java, .cs or .cpp)
Sample run 1:
Enter the width of the pyramid: 4
Enter the height of the pyramid: 10
The weight of your monument is: 9024.0
Sample run 2:
Enter the width of the pyramid: 0.5
Enter the height of the pyramid: 2
The weight of your monument is: 28.2
Sample run 3:
Enter the width of the pyramid: 55
Enter the height of the pyramid: 555
The weight of your monument is: 9.4688552E7
Program 1: ASCII Art. Computer graphics were really awful when Personal Computers first came to market. In fact, many computers would show spreadsheets and even full video games using only ASCII characters (look up Nethack, Angband, or even Medievia). We’ll start the beginning of your ASCII Art career by drawing squares that are based on user input. Write a function called drawBox that takes in number representing the width of the square. In main, ask the user for a number and then “draw” a box of that size by calling that function. There are several ways to code this, but you must have one function that you call from main. If you create additional functions that are called from that function, you’re that much more powerful! Hint #1: this is done by drawing individual characters. Hint 2: drawing the top and bottom lines are the same. How would you draw just the second line of Sample Run #3 below? Hint 3: a size of 1 is a special case…
Your task is to design (pseudocode) and implement (source code). For the source code, name your class “A5_1” and put it into a file called “A5_1” (either .java, .cs or .cpp)
Document your code and properly label the input prompt and the outputs as shown below.
Sample run 1:
Enter the size of the box: 1
*
Sample run 2:
Enter the size of the box: 2
* *
* *
Sample run 3:
Enter the size of the box: 5
* * * * *
* *
* *
* *
* * * * *
Sample run 4:
Enter the size of the box: 10
* * * * * * * * * *
* *
* *
* *
* *
* *
* *
* *
* *
* * * * * * * * * *
Program 2: P0\/\/|\|3D. In the early 80s, hackers used to write in an obfuscated, but mostly readable way called “leet” – short for “elite”. In essence, it was a simple character replacement algorithm, where a single “regular” character was replaced by one or more “leet” characters; numbers remained the same. Here’s one of the most readable versions:
a |4 |g |9 |m |/\\/\\ |s |$ |y |‘/ | |b |B |h ||-| |n ||\\| |t |7 |z |Z | |c |( |i |1 |o |0 |u |U | | | |d |D |j |j |p |P |v |\\/ | | | |e |3 |k ||< |q |Q |w |\\/\\/ | | | |f |Ph |l |L |r |R |x |>< | | | |
Note! You will need to know how to 1) get the length of a string (the number of characters) and 2) access individual characters of the string. See the appendix for more information. You must call your function translateToL337. Note #2: your first task should be to try to print out a single ‘\’ character…
Your task is to design (pseudocode) and implement (source code). For the source code, name your class “A5_2” and put it into a file called “A5_2” (either .java, .cs or .cpp)
Sample run 1:
Enter a string: you have been powned
'/0U |-|4\\/3 B33|\\| P0\\/\\/|\\|3D
Sample run 1:
Enter a string: you have programming skrilz
'/0U |-|4\\/3 PR09R4/\\/\\/\\/\\1|\\|9 $| ................
................
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 download
- special characters for the web usda
- ascii values and characters
- introduction to programming
- wawf first line haul mode codes
- non ascii character translation conversion list
- assignment 4
- complete list of ascii codes format word document www
- chapter 6 standards and conventions
- documentation
- appendix 6 35 irrd dd form 1348 1a with code 39 three
Related searches
- writing assignment for 2nd grade
- aesop substitute assignment aesop online
- 6th grade writing assignment ideas
- 6th grade writing assignment pdf
- 9th grade writing assignment worksheet
- 9th grade writing assignment classroom
- 10th grade writing assignment idea
- biol 101 individual assignment 1
- aesop substitute assignment pin number
- literacy narrative assignment essay
- online homework assignment help
- new york life assignment form