Answer to Question #289076 in C++ for jayz

Question #289076

Write a program that reads Final Year Project (FYP) that consist of Viva score and report marks of

5 (five) students to 2-dimensional (2-D) array named student. The elements from the array

must be initialize to 0 during declaration. The overall FYP marks is measured as follows:


FYP marks=(Viva*0.5)+(Report*0.5)


The viva score and overall FYP marks must be stored in the 2-D array. Then, determine the

followings:

(i) Average of FYP marks

(ii) Highest FYP marks

(iii) Lowest FYP marks

(iv) Suppose that FYP Best Presenter Award is given to students with viva score of 80 and

above, determine the number of students that eligible to receive the award

(v) Suppose that FYP Award is given to students with overall FYP marks of 80 and above,

determine the number of students that eligible to receive the award

(vi) Suppose that pass mark for FYP is 60 and above, determine the percentage of the pass

student


1
Expert's answer
2022-01-20T16:17:51-0500
#include <iostream>

struct Student
{
  int Viva = 0;
  int Report = 0;
  double calculate_mark()
  {
    return Viva * 0.5 + Report * 0.5;
  }
};

int main()
{
  Student student[2][2] = {};

  for (int i = 0; i != 2; ++i)
  {
    for (int j = 0; j != 2; ++j)
    {
      student[i][j].Viva = rand() % 100;
      student[i][j].Report = rand() % 100;
    }
  }

  double fyp = 0.0;
  double highest = 0.0;
  double lowest = 456987123.52;
  int number_of_viva = 0;
  int number_of_fyp = 0;
  int number_of_pass = 0;
  for (int i = 0; i != 2; ++i)
  {
    for (int j = 0; j != 2; ++j)
    {
      double current = student[i][j].calculate_mark();
      fyp += current;
      if (current > highest)
      {
        highest = current;
      }
      if (current < lowest)
      {
        lowest = current;
      }
      if (current >= 80)
      {
        number_of_fyp++;
      }
      if (student[i][j].Viva >= 80)
      {
        number_of_viva++;
      }
      if (current >= 0)
      {
        number_of_pass++;
      }
    }
  }
  double average_fyp = fyp / 4;
  std::cout << average_fyp << std::endl;


  return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog