You are on page 1of 3

Assignment #1

Week 1 - Computer Programming Concepts (A Review)

Name: __________________________________ Score:


Student Number: Date: ___________
Section/Schedule: _________ ______
Subject: Object Oriented Programming_ Professor:_ 30

Objectives:
• Understand the program development life cycle and apply it in problem solving
• Apply any programming languages learned previously

Instructions:

 Given the problem below, perform the Basic Steps of Program Development Life
Cycle.

Problem:

 Create a program that will Enter or accept the Sales Amount of the sales agent, then compute
and display the Commission earned based on the Sales amount range and percentage rate on
the table below:

Sales Amount (Pesos) Percentage Rate


1 – 1,000 1%
1,001 – 5,000 5%
5,001 – 10,000 10%
10,001 - up 15%

Tasks:

Step 1. Problem Definition (5 points)

There is a need for a program that would calculate and display the commission of the
sales agent through the input of sales amount by the user. Commission depends on
the sales amount and its equivalent percentage rate.

Step 2. Problem Analysis (Analyze the following:) (5 points)

Answers:
Problem Definition: User will input the sales amount of the sales agent. The
program shall then compute and display the commission.

Input Requirements: Sales Amount

Process Requirements: Multiplication (Sales amount * Percentage Rate =


Commission)

Output Requirements: Commission

Step 3. Algorithm Design and Representation


(Place the Flow Chart below)

A. FLOW CHART: (5 points)

(Write the Algorithm below)

B. ALGORITHM: (5 points)

1. Start
2. Input the sales amount (sa).
3. If (sa <= 1000)
Compute commission as sales amount * .01
Else if (sa >= 1001 && sa <= 5000)
Compute commission as sales amount * .05
Else if (sa >= 5001 && sa <= 10000)
Compute commission as sales amount * .10
Else if (sa >= 10001)
Compute commission as sales amount * .15
4. Display commission
5. Stop

Step 4. Coding and Debugging. Write the Program Codes below. (10 points)

Note: You can use any programming language that you know already.

SOURCE CODES:

C#

using System;

namespace Activity
{
class Program
{
static void Main(string[] args)
{

Console.WriteLine("Enter SALES AMOUNT:");


double sales = 0;
double comm = 0;
sales = Convert.ToDouble(Console.ReadLine());

if (sales <= 1000)


comm = sales * .01;

else if (sales >= 1001 && sales <= 5000)


comm = sales * .05;

else if (sales >= 5001 && sales <= 10000)


comm = sales * .10;

else if (sales >= 10001)


comm = sales * .15;

Console.WriteLine("");
Console.WriteLine("Commission: " + Math.Round(comm, 2) + " Pesos");

Console.ReadKey();

You might also like