Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program in C++ using printf and scanf to calculate the registration char

ID: 3710990 • Letter: W

Question

Write a program in C++ using printf and scanf to calculate the registration charge for 10 attendees to a convention.

The convention has a base price of $1500.00.

Each attendee is required to register for at least one workshop. A 50.00 surcharge per workshop for the first two, and 20.00 for any additional workshops. The number of workshops for each attendee should be saved in an array.

There will be 7 workshops offered. Validate input with a do while loop that the number of workshops is between 1 and 7 inclusive.

This program should prompt the user for the number of workshops each attendee has registered and store the number of workshops for each attendee in an array.

After calculation, the program should then print the following to the screen as output.

The number of workshops and the registration for each attendee

Total Number of workshops

The Grand total of all registration.

Explanation / Answer

#include <iostream>

using namespace std;

int main()
{
    //Base Price For Convention
    int convention_price=1500;
    int attendee[10];
    int workshop_choice;
  
    for(int i=1;i<=10;i++){
      
        do{
            printf("Enter no of workshop attend by attendee %d:",i);
            scanf("%d",&workshop_choice);
        }while(!(workshop_choice>=1 && workshop_choice<=7)); //Keep Asking input for particular attendee unless he enters number of workshops between 1 and 7
      
        attendee[i]=workshop_choice;
    }
  
    int registration_price;
    int total_registration=0;
    int total_registration_price=0;
    for(int j=1;j<=10;j++){
        //convention base price
        registration_price=convention_price; //base price for convention is 1500
        if(attendee[j]==1 || attendee[j]==2){
            registration_price+=attendee[j]*50; // for first two workshops price is 50 per workshop
        }
      
        if(attendee[j]>2){
            registration_price+=(2*50)+(attendee[j]-2)*20; // number of workshop greater than 2 will have surcharge of 20 each and first two will have surchare of 50 each
        }
        total_registration_price+=registration_price;
        total_registration+=attendee[j];
        printf("Attendee %d has registered for %d workshops and price for wrokshop is %d ",j,attendee[j],registration_price);
        registration_price=0;
    }
    printf("Total Workshops Registration %d and Grand Total Price For Registration is %d",total_registration,total_registration_price);
    return 0;
}

-------output-------

Enter no of workshop attend by attendee 1:2                                                                                           
Enter no of workshop attend by attendee 2:4                                                                                           
Enter no of workshop attend by attendee 3:6                                                                                           
Enter no of workshop attend by attendee 4:2                                                                                           
Enter no of workshop attend by attendee 5:3                                                                                           
Enter no of workshop attend by attendee 6:7                                                                                           
Enter no of workshop attend by attendee 7:1                                                                                           
Enter no of workshop attend by attendee 8:4                                                                                           
Enter no of workshop attend by attendee 9:5                                                                                           
Enter no of workshop attend by attendee 10:6                                                                                          
Attendee 1 has registered for 2 workshops and price for wrokshop is 1600                                
Attendee 2 has registered for 4 workshops and price for wrokshop is 1640                                                              
Attendee 3 has registered for 6 workshops and price for wrokshop is 1680                                                              
Attendee 4 has registered for 2 workshops and price for wrokshop is 1600                                                              
Attendee 5 has registered for 3 workshops and price for wrokshop is 1620                                                              
Attendee 6 has registered for 7 workshops and price for wrokshop is 1700                                                              
Attendee 7 has registered for 1 workshops and price for wrokshop is 1550                                                              
Attendee 8 has registered for 4 workshops and price for wrokshop is 1640                                                              
Attendee 9 has registered for 5 workshops and price for wrokshop is 1660                                                              
Attendee 10 has registered for 6 workshops and price for wrokshop is 1680                                                             
Total Workshops Registration 40 and Grand Total Price For Registration is 16370

----Output Explanation----
// For Attendee 1: Base Price=1500, 2 Workshops=100(50 per workshop for first two), registration price=1500+100=1600
// For Attendee 2: Base Price=1500, 4 Workshops=140(50 per workshop for first two and 20 per workshop for remaining two workshops), registration price=1500+140=1640
// For Attendee 3: Base Price=1500, 6 Workshops=180(50 per workshop for first two and 20 per workshop for remaining four workshops), registration price=1500+180=1680
// For Attendee 4: Base Price=1500, 2 Workshops=120(50 per workshop for first two and 20 per workshop for remaining one workshops), registration price=1500+120=1620

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote