🔒 Closed C++ beast programmer! help!

Status
Not open for further replies.

iskabet

Honorary Poster
Patulong naman mga paps sa codes nitong mga to sa c++. Codes lang po sobrang napasaya niyo na po ako hanggang pasko! Salamat!
 

Attachments

  • received_1627386817305833.webp
    received_1627386817305833.webp
    209.2 KB · Views: 32
  • received_1627386970639151.webp
    received_1627386970639151.webp
    191 KB · Views: 20
  • received_1627387450639103.webp
    received_1627387450639103.webp
    204.4 KB · Views: 17
  • received_1627387687305746.webp
    received_1627387687305746.webp
    228.2 KB · Views: 18
ang problem 1 mo lang ang sasagutan ko lang ang problem #1 mo..ang gamit ko na studio is vs 2010
Code:
#include <iostream>;
#include <conio.h>;

using namespace std;

int main(){
   int salary=0;
   int yearsinservice=0;
   char status;
   float rate;
   int bonus;

   cout<<"Monthly Salary:";
   cin>>salary;
   cout<<"Years in Service:";
   cin>>yearsinservice;
   cout<<"Status(F=Full-Time/P=Part Time):";
   cin>>status;

   switch(status){
   case 'F':
   case 'f':
           if(yearsinservice>=1 && yearsinservice<=5){
               rate=0.10;
               bonus=salary+(salary*rate);
               cout<<"Bonus: "<<bonus<<endl;

           }
           if(yearsinservice>=6 && yearsinservice<=10){
               rate=0.50;
               bonus=salary+(salary*rate);
               cout<<"Bonus: "<<bonus<<endl;

           }
           if(yearsinservice>=10){
               rate=0.75;
               bonus=salary+(salary*rate);
               cout<<"Bonus: "<<bonus<<endl;

           }
       break;
   case 'P':
   case 'p':
               if(yearsinservice>=1 && yearsinservice<=5){
                   rate=0.05;
                   bonus=salary+(salary*rate);
                   cout<<"Bonus: "<<bonus<<endl;

               }
               if(yearsinservice>=6 && yearsinservice<=10){
                   rate=0.35;
                   bonus=salary+(salary*rate);
                   cout<<"Bonus: "<<bonus<<endl;

               }
               if(yearsinservice>=10){
                   rate=0.60;
                   bonus=salary+(salary*rate);
                   cout<<"Bonus: "<<bonus<<endl;

               }
           break;
   default:
       cout<<"Error 101:Please enter only F for Full-time or P for Part-time. Thank You";
   }

   getch();
   return 0;
}
 
Status
Not open for further replies.

Similar threads

About this Thread

  • 3
    Replies
  • 675
    Views
  • 4
    Participants
Last reply from:
jokerger25

Trending Topics

Online now

Members online
1,008
Guests online
1,227
Total visitors
2,235

Forum statistics

Threads
2,273,906
Posts
28,952,291
Members
1,234,983
Latest member
Ryu Kali
Back
Top