CS134 Unit 03 Exercise: Designing software

Table of Contents


1. Student A, B, and C Instructions

1.1. Creating a code file

You will first need to create a code file within your "studentA" folder.

You can add a file by hovering over the "studentA" folder, clicking the "…" menu, then selecting "Add file".

You can name your file anything, just don't have spaces. The file extension should reflect which language you want to use:

C++ Lua Python
.cpp .lua .py

1.2. Starter code

Use one of the following items as starter code:

C++

#include <iostream>
using namespace std;

int main()
{
  cout << "Hello, world!" << endl;
  return 0;
}

Lua

print( "Hello, world! (Lua edition :)" )

Python

print( "Hello, world! (Python edition :)" )

1.3. Running the starter code

Before getting started on the assignment, make sure that the starter code runs alright. Use the cd command to go into your folder:

cd studentA

And from here, run your program:

C++

g++ FILENAME.cpp && ./a.out

Lua

lua FILENAME.lua

Python

python3 FILENAME.py

1.4. Program instructions

  1. Find a (short) recipe off a website. (Example: https://www.allrecipes.com/recipe/246889/super-easy-peanut-butter-cookies/)
  2. Using print statements (Lua/Python) or cout statements (C++), write a program that displays that recipe to the screen. Make sure that the output is readable, such as having sections clearly marked.
  3. Afterwards, have a teammate run your recipe program, and run one of your teammates' programs. Each of you give constructive feedback: a. Is it easy to read the program? b. Is it clear what this propgram does? c. Any ideas to make the design better?

1.5. Example output

------------------------------------------------------------------------------------------
Super Easy Peanut Butter Cookies
From https://www.allrecipes.com/recipe/246889/super-easy-peanut-butter-cookies/
------------------------------------------------------------------------------------------

INGREDIENTS
- 1 cup smooth peanut butter
- 1/2 cup white sugar
- 1 large egg

DIRECTIONS

  STEP 1: Preheat the oven to 325 degrees F (165 degrees C).

  STEP 2: Mix together peanut butter, sugar, and egg in a large bowl until well blended.

  STEP 3: Roll dough into 24 balls; place 4 inches apart on ungreased baking sheets. Flatten each ball with the back of a fork.

  STEP 4: Bake in the preheated oven until lightly browned, about 20 minutes; do not overbake. Cool on the baking sheets for 5 minutes, then transfer to wire racks to cool completely. 

Author: Rachel Wil Sha Singh

Created: 2023-09-07 Thu 10:35

Validate