Problem 1. Suppose you have to design software for the Oscar Jury members where they can ate the nominated movies on a scale of 1-10. Here is the movie list • Nayak: The Hero • The Cloud-Capped Star • The Music Room ● Pather Panchali Charulata Subarnarekha Days and Nights in the Forest • • The Unnamed The program will ask five judges to rate movies one by one. After completing the rating from all ive judges, the output window will show the movie name and its rating in a. ascending order of rating if your ID is even. b. descending order of rating if your ID is odd. Note: Use of Pointer is mandatory.

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter9: Advanced Array Concepts
Section: Chapter Questions
Problem 2GZ
icon
Related questions
Question

Use the descending order. And kindly give a description below after completing the code in C.

Problem 1. Suppose you have to design software for the Oscar Jury members where they can
rate the nominated movies on a scale of 1-10. Here is the movie list
• Nayak: The Hero
●
●
The Cloud-Capped Star
The Music Room
Pather Panchali
● Charulata
Subarnarekha
● Days and Nights in the Forest
● The Unnamed
The program will ask five judges to rate movies one by one. After completing the rating from all
five judges, the output window will show the movie name and its rating in
a. ascending order of rating if your ID is even.
b. descending order of rating if your ID is odd.
Note: Use of Pointer is mandatory.
Transcribed Image Text:Problem 1. Suppose you have to design software for the Oscar Jury members where they can rate the nominated movies on a scale of 1-10. Here is the movie list • Nayak: The Hero ● ● The Cloud-Capped Star The Music Room Pather Panchali ● Charulata Subarnarekha ● Days and Nights in the Forest ● The Unnamed The program will ask five judges to rate movies one by one. After completing the rating from all five judges, the output window will show the movie name and its rating in a. ascending order of rating if your ID is even. b. descending order of rating if your ID is odd. Note: Use of Pointer is mandatory.
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question

Please give the correction from this code, where I made the mistakes. The extra two output shown here. How to remove that?

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// movie structure
struct movie {
char movieName[1025];
int rating;
};

int main(void) {

// movie structure variable
struct movie list[10];
// movie structure pointer variable
struct movie *ptr = list;

int ID;
// assign std to ptr
char buff;

for (int i = 0; i < 8; i++) {
    printf("Enter number %d movie name: ",i+1);
    //scanf("%s",&ptr->movieName);
    gets(ptr->movieName);
    printf("Enter rating: ");
    scanf("%d", &ptr->rating);
    buff = getchar();
    // update pointer to point at next element
    ptr++;
}

 

// reset pointer back to the starting
ptr = list;

printf("Enter your ID: ");
scanf("%d",&ID);

struct movie temp;
for (int i = 0; i < 10; i++)
    {
    for (int j = 0; j < (9 - i); j++)
        {
            if (list[j].rating < list[j + 1].rating)
              {
                temp = list[j];
                list[j] = list[j + 1];
                list[j + 1] = temp;
              }
        }
    }

if(ID%2){
        for (int i = 0; i < 10; i++)
            printf("%s %d\n", list[i].movieName,list[i].rating);

}
else {
    for (int i = 9; i >=0; i--)
        printf("%s %d\n", list[i].movieName,list[i].rating);

}
return 0;
}

Enter rating: 4
Enter number 2 movie name: deffe
Enter rating: 3
Enter number 3 movie name: dcedf
Enter rating: 6
Enter number 4 movie name: edcfew
Enter rating: 2
Enter number 5 movie name: decef
Enter rating: 6
Enter number 6 movie name: frrf
Enter rating: 9
Enter number 7 movie name: refref
Enter rating: 5
Enter number 8 movie name: edrfe
Enter rating: 4
Enter your ID: 538648383
frrf 9
dcedf 6
decef 6
refref 5
efre 4
edrfe 4
deffe 3
edcfew 2
♥0
à e
Process returned 0 (0x0)
Press any key to continue.
execution time : 19.834 s
Transcribed Image Text:Enter rating: 4 Enter number 2 movie name: deffe Enter rating: 3 Enter number 3 movie name: dcedf Enter rating: 6 Enter number 4 movie name: edcfew Enter rating: 2 Enter number 5 movie name: decef Enter rating: 6 Enter number 6 movie name: frrf Enter rating: 9 Enter number 7 movie name: refref Enter rating: 5 Enter number 8 movie name: edrfe Enter rating: 4 Enter your ID: 538648383 frrf 9 dcedf 6 decef 6 refref 5 efre 4 edrfe 4 deffe 3 edcfew 2 ♥0 à e Process returned 0 (0x0) Press any key to continue. execution time : 19.834 s
Solution
Bartleby Expert
SEE SOLUTION
Knowledge Booster
Random Class and its operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,