Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Fall 2011_CS201_2 Solution required
#1
[FONT=&quot][IMG]file:///C:/DOCUME%7E1/ADMINI%7E1/LOCALS%7E1/Temp/msohtml1/01/clip_image001.gif[/IMG][/FONT]
[FONT=&quot]Assignment No. 02
Semester: Fall 2011[/FONT]

[FONT=&quot]CS201: Introduction to Programming[/FONT]
[FONT=&quot]Total Marks: 20[/FONT]

[FONT=&quot]Due Date:21/11/2011[/FONT]

[FONT=&quot]Instructions:[/FONT]

[FONT=&quot]Please read the following instructions carefully before submitting assignment. It should be clear that your assignment will not get any credit if:[/FONT]
§ [FONT=&quot]The assignment is submitted after due date.[/FONT]
§ [FONT=&quot]The submitted assignment does not open or file is corrupt.[/FONT]
§ [FONT=&quot]Assignment is copied(partial or full) from any source (websites, forums, students, etc) [/FONT]

[FONT=&quot]Note:[/FONT][FONT=&quot] You have to upload only .cpp file. Assignment in any other format (extension) will not be accepted and will be awarded with zero marks. For example, if you submit code in .doc (Word document) or .txt files, no reward will be given in any case.[/FONT]


[FONT=&quot]Objectives:[/FONT]

[FONT=&quot]The objective of this assignment is to provide hands on experience of:[/FONT]
§ [FONT=&quot]Functions[/FONT]
§ [FONT=&quot]Arrays Manipulation [/FONT]
§ [FONT=&quot]Pointers with Arrays[/FONT]


[FONT=&quot]Guidelines:[/FONT]

§ [FONT=&quot]Code should be properly indented and well commented.[/FONT]
§ [FONT=&quot]Follow C/C++ rules while writing variable names, function names etc[/FONT]
§ [FONT=&quot]Use only dev-C++ for this assignment.[/FONT]
§ [FONT=&quot]Use appropriate C/C++ structure i.e. if-else; switch statement etc to get inputs from user where required (Marks will be deducted if inappropriate structure will be used).[/FONT]








[FONT=&quot]Problem Statement[/FONT][FONT=&quot]: [/FONT]
[FONT=&quot]Write a program which calculates the increase or decrease in the annual income of a company for each year. [/FONT]

[FONT=&quot]Detailed Description[/FONT][FONT=&quot]:[/FONT]

[FONT=&quot]The program should start by asking the user to enter the company’s annual income for each year starting from year 2000 till 2009. Income must be taken in million. Implementation of following user defined functions are mandatory for this program: [/FONT]

  • [FONT=&quot]A function GetAnnualIncome(), which will take and store the income for each year in an input array. The input entered by user should be integer only. The input array should be passed as argument to the function. While taking the input, if annual income entered by the user is a negative value, the program should prompt the user to enter the income again for that year.[/FONT]

  • [FONT=&quot]A function CalcIncChange(), which will take two arrays as its arguments. This function will calculate the increase or decrease in the annual income of the company for each year by subtracting the current year income from the income of previous year. For example, to calculate income increase or decrease for year 2001, the following formula can be used:[/FONT]

[FONT=&quot]Income increase or decrease for year 2001 = Income of Year 2001 – Income of Year 2000[/FONT]

[FONT=&quot]Income of year 1999 = 1000 million[/FONT]
[FONT=&quot]The increase or decrease in the income for each year will be stored in another array. Calculated increase or decrease in the income for each year should also be displayed on the screen.[/FONT]

  • [FONT=&quot]A function CalcChangePercent(), will calculate the percentage of income increase or decrease for each year and then will display this calculated percentage on the screen. The function will take array as its argument and calculates the percentage for each year using the formula given below:[/FONT]

[FONT=&quot]Income increase or decrease in percentage for year 2001 = (Income increase or decrease for year 2001 / Income of Year 2000) * 100[/FONT]

[FONT=&quot]After calculating the percentage for each year, it should be displayed on the screen as well.[/FONT]

  • [FONT=&quot]A function IncDecYears(), will be used to display the years in which the company income increased and years in which company income decreased. [/FONT]
  • [FONT=&quot]A function MaxIncDecYears(), will take a pointer to an array and by using pointer arithmetic, displays only those two years in which the company faced maximum increase and maximum decrease in its income. [/FONT]

Reply
#2
Is ka solution send kr den please
Reply
#3
Abi tu 21 he last date ho sabar karo sabar ka phal meetha hota he Tongue
Reply
#4
yah wesay irfan shaib app ki web kon c hai.
Reply
#5
choro sir g ap ko 1 link laganey ka kaha tha ap ney wohi nai lagaya yaad he Smile
Reply
#6
hahaha. link aesay thoray hi lagtay han..... janab.... is kay liya mahnat kerni perti hai na. Like assignments ki tarhan.
Reply
#7
Han g website owner ki marzi he na lagye ya na lagya link warna hota tu kuch b nai, by the way result waley din meri site 1st number pe a gai thi Smile
Reply
#8
Code:
#include<iostream.h> #include<conio.h> void GetAnnualIncome(int[],int); void CalcIncChange(int[], double[],int); void CalcChangePercent(int[], double[], float[], int); void IncDecYears(double[], int); void MaxIncDecYears(int,int); main() { int anlIncm[10]; double chngInc[10]; float chngIncPer[10]; cout"\t\t .... ABC Company Income Sheet ....\n"endl; cout"Enter Income for Past 10 Years (in Millions)\n"endl; GetAnnualIncome(anlIncm,10); CalcIncChange(anlIncm, chngInc, 10); CalcChangePercent(anlIncm, chngInc,chngIncPer, 10); IncDecYears(chngInc, 10); coutendlendl; system("pause"); } void GetAnnualIncome(int inc[],int size) { int var; for(int i=0;i<size;i++) { cout"Income for Year "2000+i" : "; cin>>var; if(var < 0) { i--; } else if(var >=0 ) { inc[i] = var; } } } void CalcIncChange(int inc[], double chg[],int size) { cout"\n\n"; chg[0] = inc[0] -1000; for(int i=1;i<size;i++) { chg[i] = inc [i] - inc[i-1]; } for(int i=0;i<size;i++) { if (chg[i] >= 0) { cout"Income Increase in Year "2000+i" : "chg[i]"million"endl; } else if (chg[i] < 0) { cout"Income Decrease in Year "2000+i" : "chg[i]*-1"million"endl; } } } void CalcChangePercent(int inc[], double chg[], float per[], int size) { cout"\n\n"; per[0] = (chg[0]*100 / 1000); for(int i=1;i<size;i++) { per[i] = (chg [i]*100 / inc[i-1]); } for(int i=0;i<size;i++) { if (per[i] >= 0) { cout"Income Increase in Year "2000+i": "per[i]"%"endl; } else if (per[i] < 0) { cout"Income Decrease in Year "2000+i": "per[i]*-1"%"endl; } } } void IncDecYears(double chg[], int size) { int max, min; cout"\n\nIncome Increased in the following years: "endl; for(int i=0;i<size;i++) { max=min=0; if (chg[i] >= 0) { if(chg[max] < chg[i]) { max = i; } cout2000+i", "; } } cout"\n\nIncome Decreased in the following years: "endl; for(int i=0;i<size;i++) { if (chg[i] < 0) { if(chg[min] > chg[i]) { min = i; } cout2000+i", "; } } MaxIncDecYears(max+2000,min+2000); } void MaxIncDecYears(int max,int min) { cout"\n\nYear with maximium income Increase: "maxendl; cout"Year with maximium income Decrease: "minendl; }

0300-9520262
Get solution in 24 hour
|cpmputer & internetConfusedmileys81:[SIZE="4"][SIZE="3"]....[/SIZE][/SIZE]
Reply
#9
is main tou error hain
Reply
#10
Thanks for the Idea
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  get your solution in 24 hours 2020 Xpert 0 8,800 10-11-2020, 10:09 PM
Last Post: Xpert
  get your solution in 24 hours 2020 Xpert 0 3,180 10-11-2020, 10:09 PM
Last Post: Xpert
  vuhelp.com forum is providing solution of virutal university students in 24 hour 2014 Xpert 3 2,489 11-17-2014, 06:11 PM
Last Post: leo861323
  GDB of FIN730 - Investment Analysis & Portfolio Management (Need Solution) Muhammad Husnain Mughal 1 1,876 05-15-2014, 08:21 PM
Last Post: hondasr8
  GDB of FIN723 - Taxation Management (Need Solution) Muhammad Husnain Mughal 1 2,930 05-07-2014, 04:09 AM
Last Post: Vuhelper
  Need ACC501 - Business Finance Assignment No 2 Solution. Umar Abbas 2 4,251 02-07-2014, 08:23 PM
Last Post: Umar Abbas
  operating assinment solution help nenanena 9 6,097 08-18-2013, 03:53 AM
Last Post: Xpert
  Need Assignments solution detailer 2 3,137 11-21-2012, 02:52 PM
Last Post: Vuhelper
  need fall 2012 mgt111 gdb solution urgently eshal ch 1 3,064 11-16-2012, 12:16 AM
Last Post: Vuhelper
  Urgent need Cs201 first assignmt solution r_traveler 4 2,265 11-07-2012, 01:47 AM
Last Post: Xpert

Forum Jump:


Users browsing this thread: 1 Guest(s)