Psuedocode, html, css and javascript and normalisation Flashcards
Describe a class diagram for a class called House with attributes for square footage and number of rooms.
Write the pseudocode for a fully encapsulated House class. You do not have to write code for the get and set methods.
class House
private squareFootage
private rooms
public procedure new (givenSquareFootage, givenRooms)
squareFootage = givenSquareFootage;
rooms = givenRooms;
endProcedure
endClass
Write pseudocode to create a House object.
myHouse = new House (5000, 10)
Psuedocode example for superclass
Psuedocode example for subclass
What must the subclass constructor always contain
A ‘super’ call and be the first statement in the subclass constructor
Example of a setter method
public procedure setName(newName)
name = newName
endProcedure
Example of a getter method
public function getName()
return name
endFunction
Are attributes + or -
- -to indicate private access modifier
Are methods + or -
+ to indicate public access modifier
How to read one line from a file
myFile = openRead(“test.txt”)
line = myFile.readLine()
myFile.close()
What is the issue with reading lines
Cannot go to a specific line to read it the code will read the first line
Printing all lines from a file
myFile = openRead(“sample.txt”)
while NOT myFile.endOfFile()
print(myFile.readLine())
endwhile
myFile.close()
Writing one line to a file
myFile = openWrite(“sample.txt”)
myFile.writeLine(“Hello World”)
myFile.close()
First normal form
each record (row) is unique i.e. it has a primary key
Each data item cannot be broken down any further (is atomic) e.g. addresses should be broken up
Each field (column) has an unique name
No fields (columns) that represent a group of data
Second normal form
Non-key fields must depend on every part of the primary key. If the primary key is not composite, this condition will be met
What is a composite primary key
When 2 fields together are used as the primary key
Third normal form
Non-key fields depend only on the primary key, could not have branch name which depends on branch ID if branch ID was not the primary key
How to use image tag html