I need help :(

This is a discussion on I need help :( within the C++ Programming forums, part of the General Programming Boards category; This is what i need to do. *NO PASS BY REFERENCE CAN BE USED, ONLY VALUES* Write a C program ...

  1. #1
    Registered User
    Join Date
    Feb 2010
    Posts
    1

    Thumbs up I need help :(

    This is what i need to do.

    *NO PASS BY REFERENCE CAN BE USED, ONLY VALUES*
    Write a C program to aid the Michigan Bookstore in estimating its business for next quarter. Experience has shown that sales depend on whether a book is required or suggested, and on whether or not it has been used before. A new, required book will sell to 90% (.90) of expected enrollment, but if it has been used before only 65% of the expected enrollment will buy it. Similarly, 40% of the expected enrollment will buy a newly suggested book, but only 20% will purchase a previously suggested book.

    INPUT
    Your program is to prompt the user for:
    - the book's 10 digit ISBN number as 10 separate characters
    - the list price per copy
    - the expected class enrollment
    - code of 'R'for required text or code of 'S' for suggested text
    - code of 'N' for a new text or code of 'O' for a text that has been used the previous quarter

    CALCULATE
    Calculate the number of copies needed and the profit if the store pays 80% of list (use global define for this). Use one to function to calculate number of books, one function to calculate the profit, and one function to output.

    OUTPUT A sample run might look like this:

    Enter book number: 0755798652
    Enter price per copy: 34.98
    Enter expected class enrollment: 31
    Enter 'R' if required or 'S' if suggested: r
    Enter 'N' if new or 'O' if not a new text: O

    ISBN: 0-75-579865-2
    Copies Needed: 20
    Profit: $ 146.92


    This is what i have

    Code:
    #include<stdio.h>
    
    //declare functions
    void inputData(char, char, char, char, char,
    			   char, char, char, char, char,
    			   float, int, char, char);
    void output(char, char, char, char, char, 
    			char, char, char, char, char,
    			int, float);
    int main(void)
    {
    	//declare variables
    	char n_1;
    	char n_2;
    	char n_3;
    	char n_4;
    	char n_5;
    	char n_6;
    	char n_7;
    	char n_8;
    	char n_9;
    	char n_10;
    	float price;
    	int enrollment;
    	char R_S;
    	char N_O;
    	int copies;
    	float profit;
    
    
    
    	//Input
    	n_1=inputData();
    	n_2=inputData();
    	n_3=inputData();
    	n_4=inputData();
    	n_5=inputData();
    	n_6=inputData();
    	n_7=inputData();
    	n_8=inputData();
    	n_9=inputData();
    	n_10=inputData();
    	inputData(price, enrollment);
    	R_S=inputData();
    	N_O=inputData();
    
    	//Calculations
    
    	//Output
    	output(n_1, n_2, n_3, n_4, n_5, n_6, n_7,
    			n_8, n_9, n_10, copies, profit);
    
    	return 0;
    }///End Main///////////////////////////////
    
    void inputData(char n_1, char n_2, char n_3, char n_4, char n_5, 
    			   char n_6, char n_7, char n_8, char n_9, char n_10,
    			   float price, int enrollment, char R_S, char N_O)
    {	
    	//Prompt user for necessary information
    	printf("Enter book number: ");
    	scanf(" %c %c %c %c %c %c %c %c %c %c", 
    		&n_1, &n_2, &n_3, &n_4, &n_5, &n_6, &n_7, &n_8, &n_9, &n_10);
    	
    	printf("Enter price per copy: ");
    	scanf("%.2f", &price);
    
    	printf("Enter expected class enrollment: ");
    	scanf("%f", &enrollment);
    	
    	printf("Enter 'R' if required or 'S' if suggested: ");
    	scanf(" %c", &R_S);
    	
    	printf("Enter 'N' if new or 'O' if not a new text: ");
    	scanf(" %c", &N_O);
    	
    	return ;
    }
    
    void output(char n_1, char n_2, char n_3, char n_4, char n_5, 
    			char n_6, char n_7, char n_8, char n_9, char n_10,
    			int copies, float profit)
    {
    	
    	
    	printf("ISBN: %c - %c %c - %c %c %c %c %c %c - %c", 
    		&n_1, &n_2, &n_3, &n_4, &n_5, &n_6, &n_7, &n_8, &n_9, &n_10);
    	printf("Copies Needed: %d", &copies);
    	printf("Profit: %f", &profit);
    
    	return;
    
    }
    What am i missing or need to add/fix? thanks in advanced

  2. #2
    a_capitalist_story
    Join Date
    Dec 2007
    Posts
    2,649

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21