Skip to main content

Posts

Showing posts from June, 2018

Perl Lab 5

Perl Lab 5 1. Create an array of string that holds the following information: your first name your last name your student Id your nationality your favorite Food your favorite singer The print the contents on the screen. A Sample output is shown below: FirstName: John LastName: Smith StudentID: 4777777 Nationality: Canadian Favourite Food: Poutine Singer: Drake 2. Write another program that creates the above output using a hash that stores the following key value pair (20 marks): FirstName - your first name  LastName -  your last name ID -  your student ID Nationality - your nationality Favourite Food - your favourite Food Favourite Singer: your Favourite Singer Process it with a foreach loop that prints the key/value pairs as shown above.  3. Write another program that stores two numbers as integers and prints the following (20 marks): First Number - 4 Second Number - 2 Sum is 6 Difference is 2 Product is 8 Average is 3

Perl Lab 9

Lab 9 - Subroutine, array, nested loop Create a perl program that simulates a popular lottery. The program ask the user to enter the number of quickpicks. Quickpick are an array of 6 integer in the range 1-49 inclusive.  The program should then generate requested number of quickpicks and display them to the user. You don't have to check for uniqueness of each number in a single array. Use a subroutine to generate random numbers. The subroutine should take a parameter that set the maximum of the range of numbers that can be generated by the subroutine.  You program should generate the following output: How Many quick picks you want?5 Quickpick number 1: 41      8       18      27      18      4 Quickpick number 2: 37      23      33      47      26      18 Quickpick number 3: 27      11      24      41      25      26 Quickpick number 4: 4       28      1       41      1       30 Quickpick number 5: 25      34      37      16      35      44

Intro Perl Ex 6

Question 1 - Simple Conditions  Create a console application that accepts two integer from the user and then displays if the values are equal or not equal. Question 2 - Equality and relational operators  Modify the above application so that application uses the following condition to display the outputs If the first value is equal to second value then the system displays "First value is equal to second value" If the first value is not equal to second value then the system displays "First value is not equal to second value" If the first value is greater than second value then the system displays "First value is greater than second value" If the first value is less than second value then the system displays "First value is less than second value" If the first value is greater or equal second value then the system displays "First value is greater than or equal to second value" If the first value is less than or equal to second

IntroJava Lab4

This week we are learning about inheritance and Polymorphism Question 1 Create a new class called Clock with the integer attributes hour, minute and second. Create a constructor that allows all instance variable to be initialized. Add a method called displayTime(). Create a subclass called AlarmClock. AlarmClock should have additional object attribute called alarmHour and alarmMinute. Add a constructor that accepts radius and length. Add a method called displayAlarmTime().  Create a main method to create two instance of the Clock- GrandPaClock and WallClock. Add two instances of AlarmClock - WristWatch and DeskClock. Add all objects into an array and print the time on all clocks. Question 2  a. Create a new class called Circle. b. Add an instance variable called radius for circle. c. Add a constructor that accepts a radius as a parameter. d. Add a default constructor that does not accept any parameters and assigns a 1 to radius. e. Add a getter method that can be used to get t

OOCpp Lab 3

This week we are learning about inheritance. Question 1 Create a new class called Circle. Add an attribute called radius for circle. Add a constructor that accepts a radius as a parameter. Add a method called getArea(). Create another class called Cylinder that inherits from Circle class. Cylinder class has an additional attribute called length. Add a constructor that accepts radius and a length. Add a method called getArea() Create a main method to create two instances of the Circle and two instances of cylinder and add all four objects into a circle array. Using a for loop print area of each object to console screen. Question 2 Create a new class called Clock with the integer attributes hour, minute and second. Create a constructor that allows all instance variable to be initialized. Add a method called displayTime(). Create a subclass called AlarmClock. AlarmClock should have additional object attribute called alarmHour and alarmMinute. Add a constructor that accepts

Weekly progress report

Weekly project progress report should be concise and clear. The purpose of the weekly progress report is to clearly communicate the progress of the project with upper management. The following items should be included in the weekly progress report.  Weekly Progress report Date: _____________ Team member name: ____________________ Work completed this week: ____________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________ Work plan for next week:  ________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________