You are on page 1of 9

Link github:

https://github.com/thaotran203/Advanced_Programming--1651/tree/master/
HW_29.1.2023_Task1
https://github.com/thaotran203/Advanced_Programming--1651/tree/master/
HW_29.1.2023_Task2
https://github.com/thaotran203/Advanced_Programming--1651/tree/master/
HW_29.1.2023_Task3
https://github.com/thaotran203/Advanced_Programming--1651/tree/master/
HW_29.1.2023_Task4

Asm1: Rhombus of Stars


This program draws a rhombus shape made out of stars on the console. The program
prompts the user to enter the size of the rhombus and then creates an instance of the
StarRhombus class with the specified size. The PrintRhombusStars method is then called on
the object to draw the rhombus on the console.

The StarRhombus class has an attribute Size that specifies the size of the rhombus. It also
has two methods: PrintARowStars and PrintRhombusStars.

The PrintARowStars method takes an integer s as input and prints a row of stars with s
stars. It first prints the necessary number of spaces to center the row within the rhombus.
Then it prints s-1 stars followed by a single star to complete the row.

The PrintRhombusStars method first prints Size rows of stars, incrementing the number of
stars in each row from 1 to Size. It then prints Size-1 rows of stars, decrementing the
number of stars in each row from Size-1 to 1.

The Main method of the Program class prompts the user to enter the size of the rhombus,
creates a StarRhombus object with the specified size, calls the PrintRhombusStars method
to draw the rhombus, and then waits for the user to press Enter before exiting.
Asm 2: Point in Rectangle
This is a C# program that defines two classes, Point and Rectangle, and tests the
IsContainsPoint method of the Rectangle class.

The Point class has two properties, X and Y, and a constructor that takes two arguments to
initialize those properties. It also has an overridden ToString method that returns a string
representation of the point.

The Rectangle class has two properties, TopLeft and BottomRight, both of which are
instances of the Point class. The Rectangle class also has a constructor that takes two
arguments, two instances of the Point class, and an overridden ToString method that returns
a string representation of the rectangle. The Rectangle class also has a IsContainsPoint
method that takes an instance of the Point class and returns a boolean indicating whether
the point is contained within the rectangle.

The Main method creates an instance of the Point class, p1, and an instance of the
Rectangle class, r1. It then calls the IsContainsPoint method of the Rectangle class with p1
as an argument and outputs the result to the console. Finally, the program waits for user
input before exiting.
Asm 3: Student System

This code defines a Student class with attributes Name, Age, and Grade. The constructor
takes values for these attributes as arguments and sets the object's attributes accordingly.
The ToString method is overridden to return a string with the student's name, age, and
grade.
This is a class named StudentClass which has a list of Student objects and two methods:

AddAStudentToList(): prompts the user to enter information about a new student and adds
the student to the list.
FindByName(): searches the list of students for a student with the given name and prints out
the student's information.
This code seems to be implementing a basic student information system, where a user can
add a student and find information about a student by name. The program continuously
prompts the user to choose between three options: create a new student, print information
about a student, or exit the program.

When the user chooses to create a new student, the program prompts the user to enter the
student's name, age, and GPA. It then creates a new Student object with this information
and adds it to a list of students.

When the user chooses to print information about a student, the program prompts the user
to enter the name of the student they wish to find. It then iterates through the list of students
and prints out the information of the student(s) whose name matches the input.
The program runs continuously in a loop until the user chooses to exit by inputting "3".

Overall, the code seems to be functioning correctly and achieves its purpose of
implementing a simple student information system.

Asm 4: Hotel Reservation

You might also like