in C++ :
Briefly explain what is bad (exactly 1 weakness), though
syntactically correct, about the
following code :
class CCar { ... };
class CEngine : public CCar { ... };
class CPiston : public CEngine { ... };
class CWindow : public CCar { ... };
class CDriver : public CCar { ... };
Engine, Piston and Window are part of Cars.. Hence it makes sense for their direct association with the car.. The Driver is an independent entity, which can exist without a Car too.. Hence driver should be having has-A relationship with Car, not a is-A relation..
in C++ : Briefly explain what is bad (exactly 1 weakness), though syntactically correct, about the...
1. Briefly explain what is wrong (exactly 1 error) with the following code. auto input = 0.0; cout << "Enter input: "; cin >> input; cout << "Result 1 = " << 1.0 / input << endl; cout << "Result 2 = << input * input 2 * input << endl; cout << "Result 3 = << input + (9- input) << endl; 11
Please explain answer :D
Question 5 (5 marks] Consider the syntactically correct C code below, which is missing a function print_diagonal include <stdio.h> • typedef int Table(100) (100); */• print diagonal (T, n) . Given a Table T, which will have n rows and n columns, print all of the 1 entries on the main diagonal of T (that is, entries whose row number and column number are equal). Remember to print a newline at the end. / ► /...
31. The following code segment is syntactically correct: int number{20}; cout << number << setbase(16) << " " << number << setbase(10) << " " << number << showpos << " " << number << endl; T__ F__ 32. The following statement wants to determine if ‘count’ is outside the range of 0 through 100: if (count < 0 && count > 100) T__ F__ 33. There is...
Question 1Which of the following statements is syntactically correct in C? A) print("Winter is coming."); B) printf("Winter "+"is"+”coming.”); C) printf(Winter is coming.); D) printf("Winter is coming."); E) None of the Above Question 2 What is the percent code used in scanf for an character? A) %c B) %f C) %d D) %lf E) None of the Above Question 3 What is the value of the following arithmetic expression? 80 – 3 * 12 + 21 / 3 A) 315 B) 37 C) 47 D) 24 E) None of...
Consider the syntactically correct C code below, which is missing a function copy_positive. #include <stdio.h> /* copy_positive(A, Aout, size) * Given an array A, which will have the provided size, copy all positive * (non-negative/non-zero) elements of A into the provided output array Aout. * Return the size of the resulting array. */ /* (your code from below would be placed here) */ void print_array(int arr[], int n){ for( int i = 0; i < n; i++ ) printf("%d ",...
Please explain if the following code is actually correct. If the following code correct, please explain why the code works and is also correct. Don’t use * Java’s Integer .toBinaryString(int) in this program./* According to the textbook and the instructor, I am not supposed to use arrays such as int binary[] = new int[25]; I guess this is the reason why this problem is starting to look kind of hard. Chapter 5 Exercise 37: Java Programming * * (Decimal to...
JAVA 5) What is the output of the following code? int a = 70; boolean b = false; if(a >= 70) { System.out.print(1); if(b==true) { System.out.print(2); } } else { System.out.print(3); if(b==false) { System.out.print(4); } } System.out.print(5); 6) What is the output of the code above using these initial values? int a = 43; boolean b = false; 7) The following method is SYNTACTICALLY correct (meaning it will compile). True or false? public boolean method() { int value = 5;...
Using what you know about qualitative research, briefly explain (one page): 1. How would you design a qualitative research study, with the goal of gaining an understanding of why parents allow their children to play football? 2. If you would use triangulation (and which type of triangulation), and if so why? THIS IS A PUBLIC HEALTH BASED QUESTION
PHC 312 Health communications from chapter 4&5 1. Explain briefly about the barriers for effective provider and patient communication? 2. Discuss the role of mass media in public health with appropriate examples?
Java 1. Can you explain it how it will be printed step by step? Thanks!! What is printed by the following? for (int i=1; i<4; i++) { for (char c=’a’; c<=’c’; c++) { if (i%2==0) { i++; System.out.println(i + " " + c); } else { c++; System.out.println(c + " " + i); } } } 2. Is there a compiler error in this code? If so, what is it? If not, what’s printed? Is there a compiler error in...