0% found this document useful (0 votes)
20 views20 pages

Oop Micro Project

oop micro project for diploma

Uploaded by

yashkuma1625
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
20 views20 pages

Oop Micro Project

oop micro project for diploma

Uploaded by

yashkuma1625
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 20
ACKNOWLEDGEMENT As usual a large number of people deserve my thanks for the help they provided me for the preparation of this term paper. First of all I would like to thank my teacher Lect. Chetna mam for her support during the preparation of this topic. I am very thankful for her guidance. I would also like to thank my friends for the encouragement and information about the topic they provided to me during my efforts to prepare this topic. At last but not the least I would like to thank seniors for providing me their experience and being with me during my work. TABLE OF CONTENT:- Introduction Logic of the programme :2.1 Creating the standard calculator :2.2. Creating the scientific calculator Output screen Source code of scientific calculator 1 2 1 1 .3 Control diagrame 4 5 6 Refernces INTRODUCTION: Accordingly, this project aims to develop source code in the form of a computer program i.e c++ that a scientific calculator could use to compute functions such as square root, the exponential, and sine functions and etc. The idea of this project that 1. Since all the mathematical function such as sin function, cos function, logarithm function are define in the library function of , thus we have return the value of the function to call function. . For menu deriven programme, here we have to use switch-case statement. . In this programme ,there are two type of calculator, wr a). Standard calculator. b). Scientific calculator. Pa . The standard calculator contain simple function such as addition , substraction etc. whereas the scientific calculator contain function sin , cosin, tan, exponential function etc. The code of the calculator application mainly comprise of two classes standard calculator and scientific calculator. The standard calculator class helps to perform stanandard calculation. The scientific calculator class in the other hand, helps to perform scientific calculations. Both classes contain static function so a to ensure that these function can be called in the main function through class name. {1.2 LOGIC OF THE PROGRAMME:- (1211 CREATING THE STANDARD CALCULATOR! The standard class aims at performing specific task related to standard calculation. These task are:- . Adding two number Substracting the second number from the first number. . Multiplying two number . Dividing first number from second. Modulus of first number by second number. RYNe w To perform the above mentioned task, the standard calculator class implements the following member function. 'UNCTION DESCRIPTION Addition retums the addition of two input number. Substraction retums the substraction of two number. Multiplication returns the multiplication of two number. Division retums the output obtained after performing operation on the input number You have to need to creat scientific calculator class to perform task related to scientific calculations. Which include finding square or cube etc. ‘The scientific calculator perform following task. Determine the square of the number. . Determine the square root of the number Determine the first number power of the second number . Determine the factorial of a number . Determine the sin, cos and tan value of the number. Determine the logarithm, natural logarithm and exponential of the number. ay pune To perform the above mentioned task in scientific calculator implements the following member function. FUNCTION DESCRIPTION Square accept a number and returns the square of the number Squae root accept a number and returns the square root of number Cube accept two number and returns the first power to 2" num. Fact retums a factorial of an input number. Sin_fan returns the sin value of an input number. Cos_fun return the cos value of an input number. Tan_fun return the tan value of an input number Log_fun return the log value of an input number Logl0_fun retum the log10 value of an input number. Exp_fun return the exp value of an input number. 1.3 CONTROL DIAGRAM This diagram tells the interconnection between various menus and sub-menus. scientific calculate This shows the transfer of control between various menus and sub menus (4 Main'Scree! Choose the type of calculator — type of calculator Beer eeu isag ara CR TES og g ras ens ee calculator screen:- lator, choose the type of function. Eee) Pres etry Pots earn ei en rod ena ea exponentia PATO tec quit Bea Se aOR Let) ast LL 1.4.3. Result screen: Pog crate) sin cos tan rao tural Togrithm oragru ea vis Cae eee eames Shien era REEL 1.5. SOURCE CODE OF SCIENTIFIC CALCULATOR IN C++:- #include #include ‘include ‘include>*b; } return(a/(*b)); double stand_cale::modulus(double *a,double *b) { while(* { cout<<"\ncannot divid by zero."; cout<<"\nenter the second nuber again"; cout<<*b; } int x~(int)*a; int y=(int)*b; 0) if(*a-x>0|/*b-y>0) cout<<"\nconverting decimal nuber into an integer to perform modulus"; * Ys return(x%y); } double scien_cal { return(pow(x,2)); } double scien_calc::cube(double x) return(pow(x,3)); } double scien_calc::power(double x,double y) f return(pow(x.y)); long int scien_cale::fact(double x) di int n=(int)x; long int F=1; while(n>1) { fon; ne} } return fy double scien_cale::sin_fan(double x) I seintoiat3) ube scien_cale::cos_fun(double x) £ san(oost) double scien_cale::tan_fun(double x) return(tan(x)); double scien_calc:slog_fun(double x) { return(log(x)); t double scien_cale::log10_fun(double x) t return(log10(x)); double scien_cale::exp_fun(double x) { retumn(exp(x)); } double scien_cale::sqrt_fun(double x) return(sqrt(x)); void main() t double num 1 ,num2,num3,temp; int choice1=0,choice?,flag; do t clrser(); cout<<" calculator — 5 cout<<"\n1\tStandard calculator \n2\tScientific calculator\n3\tQuit"; cout<<"\n choose type of the calculator”; cin>>choicel; flag-new_calc; switch(choice1) { case 1: do t clrser(): cout<<" calculator ; cout<<"\n I \taddition\n2\tsubstraction\n3\tmultiplication\n4\tdivision\nS\tmo, dulus\n6\treturn to previous menu\n7\tquit"; if(lag—old calc) cout<<"\n8\telear memory"; cout<<"\nchoose type of the calculation:"; cin>>choice2; switch(choice2) { case 1: if(flag—new_calc) t cout<<"enter the first number:' cin>>num1; I else t num1=temp: cout<<"\nfirst number is "<>num2; aum3=stand_cale::addition(aum] num2); cout<<"\naddition of "<>numl ; } else t num1=temp: cout<<"\nfirst number is"<>num2; num3=stand_cale::substract(num 1,num2); cout<<"\nsubstraction of "<>num1; 3 else t num1=temp; cout<<"\nfirst number is"<>num2; num3=stand_cale::multiplication(num|,num2); cout<<"\nmultiplication"<>num1; i else { num |=temp: cout<<"\nfirst nuber is"<>num2; num3=stand_cale::division(num1 ,énum2); cout<<"\ndivision of'<<"num1"<<"by"<>num1; i else { num |=temp; cout<<"\nfirst number is"<>num2; num3=stand_cale::modulus(&num1,&num2); cout<<"\nmodulus of "<>choice2; switch(choice2) t case 1: if(flag—new_calc) { cout<<"enter number to find square :"; cin>>num1; 3 else t num1=temp; cout<<"\n number is "<>num1; } else { num1=temp; cout<<"\n number ="<>num1; } else { num1=temp; cout<<"\nnumber is "<>num1; } else { num1=temp; cout<<"\nfirst number is"<>num2; num3=scien_cale::power(num|,num2); cout<<"\n"<>num 1; 3 else { num|=temp; cout<<"\n number to find factorial is"<>num1; } else { num|=temp; cout<<"\nnumber for sin value is"<>numl; } else { num1=temp; cout<<"\nnumber for cos value"<>num!1; t else x num1=temp; cout<<"\nnumber for tan value"<>numl; } else t num1=temp; cout<<"\nnumber for log value"<>num 1; } else { num1=temp; cout<<"\nnumber for natural log value"<>num1; 3 else t num 1=temp; cout<<"\nnumber for exponential value"<

You might also like