Design & Implement a C- program that can handle salesmen records of ABC
Company. Each salesman has unique 4-digit id #, name, salary, monthly sale &
commission (commission is computed depending on value of monthly sale). Net
income of a salesman is salary plus commission. Make maximum use of user
defined Functions.
Conditions for calculating commission are as follows:
➢ Commission is 20% of monthly sale, if sale is equal to or greater than 15,000.
➢ Commission is 15% of monthly sale, if sale is equal to or greater than 10,000
and less than 15,000.
➢ Commission is 10% of monthly sale, if sale is equal to or greater than 8,000
and less than 10,000.
➢ Commission is 5% of monthly sale, if sale is equal to or greater than 5,000 and
less than 8,000.
➢ No Commission, if sale is less than 5,000
What are the output of the program given below?
Program 1
#include <iostream>
using namespace std;
int main(){
int width = 10;
int height = 15;
double wide;
cout<<"PROGRAMME TO CALCULATE WIDE FOR TRIANGLE\n";
cout<<"##############################\n";
wide=0.5*height*width;
cout<<"\nWIDE: "<<wide<<"\n";
cout<<"\n##############################################\n";
return 0;
}
Program 2
#include <iostream>
using namespace std;
int main()
{
int x = 180, y = 200;
y = ++x;
cout << " x : " << x << endl << " y : " << y << endl;
}
consider the following program :
void main()
{
int i;
printf(“Please enter an integer: ”);
scanf(%d,&i);
printf(“\n”);
switch(i) {
case 1: printf("I am one.\n"); break;
case 2: printf("I am two.\n"); break;
default: printf("I am neither one, nor two.\n"); }
}
///////////////////////////////////////////////////////////////////////
What you see below is part of the assembly code of the above program. Complete it using MIPS assemby and use “jump address table“ method.
.data
prmt: .asciiz "Please enter an integer: "
nline: .byte '\n'
.text
.globl main
main:
li $v0,4
la $a0,prmt
syscall
li $v0,5
syscall
addi $a0,$v0,0
li $v0,1
syscall
la $t0,nline
li $v0,11
syscall
# place your switch statement's assembly program here
li $v0,10
syscall
The values of $t0 and $t1 are 0xAAFFFFFF and 0x000EF000 respectively. Write a MIPS code that swaps bits 26 to 31 of $t0 with bits 11 to 16 of $t1.
given an integer N write program which reads N inputs and prints the product of the given integers
2 3 7
B. Create a program using Python programming language that counts election vote for a president. Your program should display first the list of people who are running for president, after which your program should ask the user for his/her vote (based on number). There should be a total of 20 voters. After entering the votes of 20 voters, your program should display the winner including the number
29 / 29
of votes. It should also display the second, third until last place including the number of votes they have. Used for loop and if, elif, else statement on your program. Apply iter() and next() methods on your program. Use list in storing the votes. Observed correct variab le names.
A .Using Python programming language, create a program that allows the user to compute for his/her fare using the information below;
0-5km = P20.00
6-10km = P30.00
11-15km = P40.00
The bus only travels within the province, so the distance does not exceed from 15 kilometers. Your program should ask the user for distance travelled, and your program will compute and display the fare.
Use the If, elif, else statement on your program. Select appropriate data type and create appropriate variable names for your program.
The function accepts two positive integers ‘r’ and ‘unit’ and a positive integer array ‘arr’ of size ‘n’ as its argument ‘r’ represents the number of rats present in an area, ‘unit’ is the amount of food each rat consumes and each ith element of array ‘arr’ represents the amount of food present in ‘i+1’ house number, where 0 <= i
Using function:
a. sort a list using bubble sort algorithm (ascending and descending order). you have
to take choice from the user. also the list should be user defined
b. search an item using binary search algorithm