Encrypting your link and protect the link from viruses, malware, thief, etc! Made your link safe to visit.

Question: C programming help please!!

 

Question:


C programming help please!!

C programming help please!!


Answer:


Functions:

What calls what tree:

int main(int argc, char * argv[])

               int checkInput(int year, int month, int day) // returns 0 if ok else 1

                              int getDaysInMonth(int year, int month) // returns the # of days in month for year

int getFebDays(int year) // returns # of days in February for this year

int getNumDays(int year, int month, int day) // returns # of days in year that given date is

int getFebDays(int year) // same function called again

Function details:  Each function must follow the algorithm given below

int main(int argc, char * argv[])  // must use do while and while loops as documented

do

Ask the user to enter a year, a month and a day after 1600.

while checkInput(year, month , day) is error

Ask the user to enter a year, a month and a day after 1600.

end while error

print getNumDays(year, month, day)

Ask user do you want to quit y or n?

while user does not want to quit (does not enter y)

int checkInput(int year, int month, int day) // returns 0 if ok else -1

Print an error message if year is < 1600 or month is not 1 – 12 or day not 1 – correct number for that month and return -1

Else return 0 for no errors

// important only one return statement at the bottom of function

               Use if statement for year and month being correct

               Calls getDaysInMonth(int year, int month) and use if statement to see if days is correct

int getDaysInMonth(int year, int month) // returns the # of days in month for year

You must use a switch statement on the month to find the number of days in that month with break statements for each case.

Calls getFebDays(int Year)

int getNumDays(int year, int month, int day) // returns # of days in year

Use another switch statement with no break statements to find the day of the year. 2/1 is 31 days of January plus 1 in February for a total of 32.

This must be switch with no break statements.  Each month must add to the total only the days for that month.  As demonstrated in class.  No if or other statements on the single statement for each case that adds that month to the total.

case 11: retval += 30;

case 10: retval _= 31;

Calls getFebDays(int year) for case 2: retval += getFebDays(year);

Int getFebDays(int year) // returns # of days in February for this year

ST

Search This Blog

Labels

Report Abuse

QUESTION 6 (a) The bar shown in Figure Q2(a) is subjected to tensile load of 150 Kn. If the stress in the middle portions is limited to 160 N/mm², determine the diameter of the middle portion. Find also the length of the middle portion if the total elongation of the bar is to be 0.25 mm. E E = 2.0 + 105N/mm². (12 marks) 150 KN 10 cm DIA 10 cm DIA 150 KN 45 cm Figure Q6(a) (b) A brass bar, having cross-section area of 900 mm², is subjected to axial forces as shown in Figure Q2(b), in which AB = 0.6 m, BC = 0.8 m, and CD = 1.0 m. Find the total elongation of the bar. E = 1.0 + 105N/mm2 . (8 marks) Page 4 of 5 B D 40 KN 70 KN 20 KN 10 KN Figure Q6(b) (TOTAL = 20 MARKS)

  Question: Show transcribed image text Answer:

Question: A 250-V, 4-pole, wave-wound d.c. series motor has 782 conductors on itsarmature. It has armature and series field resistance of 0.75 ohm. The motor takesa current of 40 A. Estimate its speed and gross torque developed if it has a flux per pole of 25 mWb Answer: Step 1 Mechanical Engineering homework question answer, step 1, image 1 Mechanical Engineering homework question answer, step 1, image 2 Step 2 Mechanical Engineering homework question answer, step 2, image 1 Step 3 Mechanical Engineering homework question answer, step 3, image 1

Question: A 250-V, 4-pole, wave-wound d.c. series motor has 782 conductors on itsarmature. It has armature and series field resistance of 0.75 ohm. The motor takesa current of 40 A. Estimate its speed and gross torque developed if it has a flux per pole of 25 mWb Answer: Step 1 Step 2 Step 3

Contributors