Download Getting Started - Al Akhawayn University

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Halting problem wikipedia , lookup

System of polynomial equations wikipedia , lookup

Factorization of polynomials over finite fields wikipedia , lookup

Transcript
Lab 4
 Exercises
Note for next time:
 Read Chapter 1 and 2 (Self_check exercises and all
exercises)
 Pay attention to the Program Style (page 57) all your
programs must follow this style.
 Look at :ctype.h and stdlib.h
Exercise1
A salesman receives a commission of 10% on all sales if he had sold at
least $10 000 worth of merchandise in a given period, but only 8.5% if
his sales are below $10 000.

Write an algorithm to show to the salesman how to figure out
his commissions.

Modify the algorithm to accommodate a list of salesmen along
with their sales.

Change the algorithm as needed to calculate the commission of
all the salesmen (the total of commissions).
Exercise2
 the problem’s specification is to find out the smallest, largest, range,
average, and standard deviation of N numbers.

Given: average= sum/N

std_dev= sqrt(sum_squares/N – (average**2))
Exercise3
 The problem’s objective is to find the greatest common divisor (GCD)
of two integers.
Exercise4
Crammer rule is a method for solving a system of linear equations.
If you have two equations with variables x and y written as
ax + by = c
dx + ey = f
then the solution for x and y can be given as:
The notation below refers to the determinant ae -bd
1. Write a complete algorithm that will solve a system of two equations
using Cramer’s rule. Input will be all the coefficients. Output will be the
solution of the system.
2. Modify the algorithm to be used for other systems (Use Repetition).
Exercise5
As a part time job student, you are working for the Family Budget Assistance
Center. Your boss has asked to write a program that will analyze data for a
family list.
Input for each family consist of:
 Family identification number
 Number in Family
 Annual income
 Total debt
Output should include the following
 The family identification number, number in family, annual income, and total
debt
 Predicted family living expenses ($3000 times the total number of the family)
 The monthly payment necessary to pay off the debt in one year (Debt/12)
 The amount the family should save (The family size * 2% of (the income - the
debt))
 Your service fee (0.5 percent of the income)