vault backup: 2024-03-21 22:58:58

This commit is contained in:
2024-03-21 22:58:58 +00:00
parent 68fa81d02f
commit e241fe8bd6
49 changed files with 1950 additions and 210 deletions

View File

@@ -0,0 +1,65 @@
private void readFilmData(String fileName) throws IOException //1
{
File filmFile = new File(filename); //2
Scanner scanner1 = new Scanner( filmFile ); //3
while (scanner1.hasNext() ) //4 could throw a FileNotFoundExcpetion
{
String line = scanner1.nextLine(); //5
Scanner scanner2 = new Scanner(line);
scanner2.useDelimiter("[ ]*(,)[ ]*");
String filmTitle = scanner2.next();
String filmRating = scanner2.next();
int short = scanner2.nextInt();
// other code here to read & store rest of data
scanner2.close();
}
scanner1.close();
}
Citizen ->
English ->
Mancunian,
Londoner
Scots
Citizen person1;
English person2;
Scots person3;
Mancunian person4;
Londoner person5;
person1 = new Londoner();
person1 type Citizen. Legal
person2 = new Mancunian();
person2 type English. Legal
person5 = new English();
person5 type Londoner. Illegal
persona2 = new Scots();
person2 type English. Illegal
factorial(3) ->
x = 2
y = factorial(2)
factorial(2) ->
x = 1
y = factorial(1) -> 1
n*y = 2*1 = 2
n*y = 2*3 = 6
public int countTree(BinTreeNode t)
{
int count;
if (t == null)
count = 0;
else
count = countTree(t.leftChild) + 1 + countTree(t.rightChild);
return count;
}