Reference no: EM132292589
Principles of Programming Assignment - Weekly Programming Work
Learning Outcomes - This assessment addresses the following subject learning outcomes:
a) Synthesise the tenets of procedural programming into the object-oriented paradigm.
b) Apply an integrated development environment (IDE) using the principles of agile methodology to create, compile, test and run programs to address business problems.
c) Apply object-oriented concepts to construct classes and methods to solve problems and make decisions.
This assignment is designed for you to progressively add to your understanding of software development using a mid-level programming language that supports object-oriented development. It also introduces you to some of the systems analysis techniques that will feature in later subjects of the Master of Business Information Systems.
Instructions: Submit the learning activities for each module.
Module 2 -
2.1 -
1. Write your favourite recipe in pseudocode.
= Include the recipe for cake or anything which is familiar with Nepalese food item.
2. Write simple pseudocode that solves the problem of getting ready in the morning to attend work or the university.
3. Write some more advanced pseudocode that includes a selection based on a condition for getting ready in the morning to attend work or the university. An example test might be use the iron to press your clothes
4. Finish your pseudocode now with an iteration of your choosing. An example, if you cannot think of one is cycle through your outfits until you find the one you think looks best.
2.2 -
1. List as many things that can go wrong in an online purchase transaction that you can think of. For each of these potential errors, think of a way in which a set of instructions can protect against it failing to achieve its objective.
2. With all the knowledge you gained in this module, write an algorithm that facilitates a web-based online transaction. Make whatever assumptions you deem necessary and make them known at the top of your algorithm.
MODULE 3 -
3.2 Activities -
There are several activities in this module and you are expected to complete all of these in the labs or in class or in your own time. The first of these is to reproduce any and all of the worked examples in the module content and to review the readings and videos. Then, work your way through these exercises:
1. Access the Australian Taxation Office website and find the current tax tables for individuals. Write a program that asks the user to enter their tax file number (using a 'string' data type) and then to enter their taxable income for the current financial year. If the user does not have an Australian tax file number, they should enter '0' instead. Then, based on the taxable income, the program should return the tax payable on their taxable income.
2. Write a program that helps with children's multiplication. It should ask the user, which number they are learning to multiply and then produce a set of 12 multiples (i.e. from one through twelve). When execution finishes it should continue to ask for numbers to multiply unless a 0 is entered at the keyboard.
3. Write a program that accepts a date from the user in three parts: a month, a day and a year. Ensure that the date values are valid before printing the final value to the screen for the user.
4.1 Activities -
We can imagine an example object such as a car. A car will have the following members (and several others):
- colour;
- brand;
- fuel tank capacity; and
- odometer reading.
Apart from this, it may also have the following methods:
- start();
- accelerate();
- brake(); and
- stop().
The car can be thought of as an object since it has characteristics (members) such as its colour and it can perform operations (methods) on itself such as accelerating and braking. In this analogy, it can be easily seen that a car object is self-contained or encapsulated. The mechanical details of how the car performs its operations does not matter to the driver since they are using the car to travel from their point of origin to their point of destination; therefore, we can see that the details have been abstracted or hidden away.
Up until now we have discussed a car as a single object. But, as we know, there can be several cars, even several red cars of the same make and model. Therefore, the object-oriented paradigm includes a mechanism to specify what all of those cars would look and behave like. That mechanism is called a class and is a central concept in object-oriented programming.
A class is said to be the template for all objects in that family of objects. In your programming you will implement the members and methods in the above two lists in a class. When you later initialise a car object, the object is an instance of a class. You would specify a class in the following way:
class Car {
string strColour;
string strBrand;
float fltFuelTankCapacity;
int intOdometerReading;
public:
void start();
void accelerate();
void brake();
void stop();
};
Like the convention we have already established in this subject, a class must first be declared before we can refer to it later in the code. Noticing that the declaration has a semicolon that follows it, the next lines of code would be the implementations of the class methods.
4.1 Readings - Mosh 2018 'Object-oriented Programming in 7 Minutes' Programming with Mosh.
4.1 Activities -
There are a number of activities in this module and you are expected to complete all of these in the labs or in class or in your own time. The first of these is to reproduce any and all of the worked examples in the module content and to review the readings and videos. Then, work your way through these exercises:
1. Taking the in-class example of the car, continue coding this example but include one or more additional variables for the speed of the car. Include mutator and accessor methods for the car's speed and use them in the start(), accelerate(), brake() and stop() methods to extend their functionality. When the car starts, initialise its speed to 0. Allow the accelerator method to increase the speed by a given increment and the brake method to decrease by a given decrement. Print the current speed to the screen.
2. Race time: take the same example and separate the class into a header file. Write another program that instantiates two car objects, one small and the other large (if you don't know cars, look up examples for brands of cars and their fuel tank capacities). In your code, start each car and then accelerate each car at different rates. Do this in a loop three times for each car and then reverse the rates for braking. Print the name of the car that comes to a complete stop first and declare the other car the winner.
4.2 Activities -
1. Taking your work from the first half of the module, create constructor and destructor methods for the 'Car' class.
2. Write a program using the object-oriented paradigm that keeps track of bank accounts. Each class should have constructor and destructor methods, but the choice of members will be up to you. Start with a class for 'account' and then allow for different types of derived classes, such as 'savings account' and 'credit card account.' A bank account should allow funds to be added to it as well as withdrawn but not to be overdrawn. A credit card account should allow funds to be charged to it but not more than its limit. In the main () function, open a savings account with $10,000 and then make three withdrawals of $4,000, if there are enough funds. Open a credit card account, with a limit of $3000 and make two charges of $2000 if there are enough funds. If you breach the conditions for each, display an appropriate error message.
Attachment:- Assignment Files.rar