Monday, 8 April 2013
quiz
/*
Name: muhammad ifwat bin sallehuddin
Student ID: 51110113197
Group: L01 B01
Date: 28/2/2013
Question ID: s3st
*/
#include<stdio.h>
void main()
{
char choice;
float hour;
double price;
printf("Yosof Corporation Snd. Bhd\n");
printf("Compute and display wages\n");
printf("Please enter your choice by key-in the letters below\n");
printf("-----------------------------------------------------------\n");
printf("a. Computes and display hour\n");
printf("b. About\n");
printf("c. Exit\n");
printf("-----------------------------------------------------------\n");
printf("Please enter your choice:\n");
scanf("%c", &choice);
switch(choice)
{
case 'a':{}
case 'A':{
printf("Please enter your total hour:\n");
scanf("%f",&hour);
if(hour>=0 && hour<=40)
{
price=(4.00*hour);
printf("Your total hour: %.0f/hour\n", hour);
printf("Your total payment:RM %.2f\n", price);
}
else if(hour>=41 && hour<=60)
{
price=((4.00*40)+(8.00*(hour-40)));
printf("Your total hour: %.0f/hour\n", hour);
printf("Your total payment:RM %.2f\n", price);
}
else if(hour>=61 && hour<=100)
{
price=((4.00*40)+(8.00*40)+(15.00*(hour-40)));
printf("Your total hour: %.0f/hour\n", hour);
printf("Your total payment:RM %.2f\n", price);
}
else if(hour>=101)
{
price=((4.00*40)+(8.00*40)+(15.00*40)+(25.00*(hour-40)));
printf("Your total hour: %.0f/hour\n", hour);
printf("Your total payment:RM %.2f\n", price);
}
else
{
printf("Wrong/invalid input\n");
printf("Bye! Bye!\n");
}
}
break;
case 'b':{}
case 'B':{
printf("**********************About********************************\n");
printf("-----------------------------------------------------------\n");
printf("Yosof Corporation Sdn. Bhd\n");
printf("Compute and display wages\n");
printf("Version 1.1, Copyright 2011\n");
printf("-----------------------------------------------------------\n");
}
case 'c':{}
case 'C':{
printf("Wrong\n");
break;
}
default:{ printf("bye bye\n");
}
}
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment