Common Computer Science References
Create a new AWS Instance for Unit 1:
use your dotfiles to recreate your PDE
―――――――――――――――
At the end of this lesson, you will be able to:
create an application that does something useful
review the 6 computer steps to solving a structured problem
why is the "Hello World" program important
one of the biggest hurdles in programming is getting through all the "little things", just to make something show up
read, again "Problem Solving", Chapter 2, Computer Based Problem Solving
read up to and including "Problem Solving"
read the following problem:
Depending on the logging company, maple logs are cut into lengths of either 0.25 m, 0.5 m or 1m. Maple logs weigh 20 kg/m and a logging truck can carry 1100 kg. How many maple logs should be placed on a truck if you know the lengths of the logs? (Note: a truck will only take 1 length type of logs at a time).
create the first 5 steps for the above question
once your first 5 steps are approved, do the rest so that a person can select the log length and the program tells the user how many logs can go on a truck
no user input error checking needed yet
NOTE: for input, use bun-promptx:
bun add bun-promptx --save-dev
here is an example program
/**
* The program shows how to get input
* and deal with numbers.
*
* By: Mr. Coxall
* Version: 1.0
* Since: 2020-01-01
*/
import { createPrompt } from 'bun-promptx'
const name = createPrompt('What is your name? ')
console.log(`Hey there ${String(name.value)}`)
const ageString = createPrompt('What is your age? ')
let ageNumber = parseInt(ageString.value)
ageNumber = ageNumber - 10
console.log(`Age is > ${ageNumber}`)
console.log('\nDone.')
Note:
ageString is actually a Dictonary (associative array)
ageString is also of type string | null
we will worry about that next time!
Note: the ` is most likely below the "ESC" key!
with the "~"
Note: please ensure you know the difference between var, let and const
do the above in a second language
in Java you will need a "scanner"
use someString = input.nextLine(); to get a line of text
REMEMBER to "close" the scanner when done!