cs final project 2010 rohan paramesh. the programs implementing 3 programs each in c# and python ...

7
C# AND PYTHON CS Final Project 2010 Rohan Paramesh

Upload: osborne-holt

Post on 31-Dec-2015

213 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CS Final Project 2010 Rohan Paramesh. The Programs  Implementing 3 programs each in C# and Python  Student Scheduler  Assigns courses and students,

C# AND PYTHON

CS Final Project 2010Rohan Paramesh

Page 2: CS Final Project 2010 Rohan Paramesh. The Programs  Implementing 3 programs each in C# and Python  Student Scheduler  Assigns courses and students,

The Programs

Implementing 3 programs each in C# and Python Student Scheduler

Assigns courses and students, sorts according to different criteria

Twenty Questions A binary tree of QuestionNodes that writes

out to and reads from a text file Towers of Hanoi

Recursively provides a solution to the puzzle

Page 3: CS Final Project 2010 Rohan Paramesh. The Programs  Implementing 3 programs each in C# and Python  Student Scheduler  Assigns courses and students,

C#

Microsoft’s current language Compiled Java-like

Syntax Logic

An atmosphere of whatever Java got wrong is fixed in C#

Page 4: CS Final Project 2010 Rohan Paramesh. The Programs  Implementing 3 programs each in C# and Python  Student Scheduler  Assigns courses and students,

Python

Guido van Rossum Emphasis on readability Significant differences

Logic Style Syntax

Very popular nowadays with amateur developers and some large companies Google

Page 5: CS Final Project 2010 Rohan Paramesh. The Programs  Implementing 3 programs each in C# and Python  Student Scheduler  Assigns courses and students,

Towers of Hanoi

Java C#public static void solveHanoi(int

disks, int from, int other, int to) {

if (disks <= 0)

return;

solveHanoi(disks-1, from, to, other);

System.out.println("Move disk " + disks + " from pole " + from + " to pole " + to + ".");

moves++;

solveHanoi(disks-1, other, from, to);

}

public static void SolveHanoi(int disks, int from, int other, int to)

{

if (disks <= 0)

return;

SolveHanoi(disks - 1, from, to, other);

Console.WriteLine("Move disk " + disks + " from pole " + from + " to pole " + to + ".");

moves++;

SolveHanoi(disks - 1, other, from, to);

}

Page 6: CS Final Project 2010 Rohan Paramesh. The Programs  Implementing 3 programs each in C# and Python  Student Scheduler  Assigns courses and students,

Towers of Hanoi

Java Pythonpublic static void solveHanoi(int

disks, int from, int other, int to) {

if (disks <= 0)

return;

solveHanoi(disks-1, from, to, other);

System.out.println("Move disk " + disks + " from pole " + from + " to pole " + to + ".");

moves++;

solveHanoi(disks-1, other, from, to);

}

def solve_hanoi(disks, start, other, dest):

'''The main recursive method that solves the Tower of Hanoi puzzle. This method calls itself and also increments the number of moves.

disks -- the number of disks (integer)

start -- the starting peg (determined by class constant)

other -- the intermediate peg

dest -- the destination peg

'''

if (disks <= 0):

return

solve_hanoi(disks-1, start, dest, other)

print "Move disk ", disks, " from pole ", start, " to pole ", dest, "."

global moves

moves += 1

solve_hanoi(disks-1, other, start, dest)

Page 7: CS Final Project 2010 Rohan Paramesh. The Programs  Implementing 3 programs each in C# and Python  Student Scheduler  Assigns courses and students,

Comparison

Scope Methods and Parameters Types Compiled vs. Interpreted I/O Freedom/Restrictions Accuracy Readability