Commission on Sales coderinme A sales person is paid commission based on the sales he makes as shown by the following table: SALES ……………… COMMISSION Under SR500 ………….2 % of SALES SR500 and under SR5000…5 % of SALES SR5000 and over……….8 % of SALES Write a class, Commission, which has: an instance variable, sales; an appropriate constructor; and a method, commission() that returns the commission. Now write a demo class to test the Commission class by reading a sale from …

Home » Archives for code

# Author: code

Assigning Grades coderinme The certain instructor assigns letter grade for his course based on the following table: Score Grade >= 90 A+ >= 85 A >= 80 B+ >= 75 B >= 65 C+ >= 60 C >= 55 D+ >= 50 D < 50 F Write a class, Grader, which has: an instance variable, score, an appropriate constructor and appropriate methods Now write a demo class to test the Grader class by reading a score from the user, using …

Class concept using bank account problem An example of classes in c++, Bank account . credit debit and balance problem in this problem we are trying to improve your coding #include <iostream> #include <string> using namespace std; class bank_account { int acc_no; char name[20]; char acc_type[20]; double balance; public: void getdata() { cout<<"\nENTER ACCOUNT NUMBER:"; cin>>acc_no; fflush(stdin); cout<<"ENTER NAME OF ACCOUNT HOLDER:"; cin.getline(name,30); cout<<"ENTER TYPE OF ACCOUNT:"; cin.getline(acc_type,30); cout<<"ENTER BALANCE IN ACCOUNT:"; cin>>balance; } void dipo(double d) { balance=balance+d; cout<<"BALANCE …

How to make pattern this is a easy pattern like pattern program staircase using number if we will enter 1 then result will be 1 if we will input 2 output will be 1 12 same 5 1 12 123 1234 12345 #include <iostream> using namespace std; int main() { int i,j,n; cin>>n; for(i=1; i<=n; i++){ for(j=1;j<=i;j++) cout<<j; cout<<"\n"; } } if you want to learn more pattern click here

Armstrong Number coderinme Armstrong Number coderinme In order to check whether the entered number is an Armstrong number or not, we find the sum of cubes of each digit in the number. If the sum is same as the given number, then the number is an Armstrong number, otherwise it is not. Let’s check out using C #include int main() { int a,b,c=0,x; printf("Enter the Number: "); scanf("%d",&a); x = a; while( a != 0 ) { b = a …

Fibonacci Series coderinme Have you ever heard of a Fibonacci Number? Well In mathematics, the Fibonacci numbers are the numbers in the following integer sequence, called the Fibonacci sequence, and characterized by the fact that every number after the first two is the sum of the two preceding ones: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144 Write a program in the sequence 1 1 2 3 5 8 13 21 ……………… and called Fibonacci …

Minimum Maximum using Pointers Let's understand it by solving a problem. Write a function that returns the minimum and maximum value in an array of integers. Inputs to the function are the array of integers, an integer variable containing the length of the array and pointers to the integer variable that will contain the minimum and maximum values. The functions prototype is: void maxmin(int array[],int length,int*min,int*max);