Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

#include <stdio.h> enum eCut { Round, Princess, Emerald, Oval, Marquise, Pear, C

ID: 3680504 • Letter: #

Question

#include <stdio.h>

enum eCut
{
   Round,
   Princess,
   Emerald,
   Oval,
   Marquise,
   Pear,
   Cushion,
   Radiant,
   Asscher,
   Heart

};

enum eClarity
{
   F,
   IF,
   VVS1,
   VVS2,
   VS1,
   VS2,
   SI1,
   SI2,
   I1,
   I3

};

enum eColor
{
   Colorless,
   Near_Colorless,
   Faint_Yellow,
   Very_Light_Yellow,
   Fancy_Yellow
};

enum eSymmetry
{
   Off_center_culet,
   Off_center_table,
   Mishappened_facets,
   Off_Girdle,
   Crown_misalignment,
   Wavy_girdle

};
enum eAnatomy
{
   Table_Size,
   Pavilion_Angle,
   Girdle,
   Depth

};
enum eRetailers
{
   Tiffany,
   Zales,
   Kay,
   Jared,
   Johnson,
   Zelberg,
   Samuels,
   Gordons
};
struct sDiamond
{
   enum eCut Cut;
   enum eClarity Clarity;
   enum eColor       Color;
   enum eSymmetry Symmetry;
   enum eAnatomy Anatomy;
   enum eRetailers Retailers;
   float         Carat;
   float Diameter;
   float Height;
   float Price;
   int Size;
   int Breakable; //True or False


char namesofretailers[][20] = {

"Tiffany",
"Zales",
"Kay",
"Jared",
"Johnson",
"Zelberg",
"Samuels",
"Gordons"

};

typedef enum eClarity ClarityofDiamond;
typedef enum eRetailers Retailer;

int main()
{
Retailer mychoiceofRetailer;
mychoiceofRetailer = Jared;

printf(My choice of a certain Diamond retailer is %s. ", namesofretailers[mychoiceofRetailer]);

if(mychoiceofRetailer == Jared)
{
printf("Great, do not go anywhere else! ");
}

}

int main()
{
ClarityofDiamond myDiamond;

printf("Enter Clarity: ");
printf("The follwoing lines are the corresponding numerical values for the Clarity Variables: ");
printf(" 0 = F ");
printf(" 1 = IF ");
printf(" 2 = VVS1 ");
printf(" 3 = VVS2 ");
printf(" 4 = VS1 ");
printf(" 5 = VS2 ");
printf(" 6 = SI1 ");
printf(" 7 = SI2 ");
printf(" 8 = I1 ");
printf(" 9 = I3 ");

scanf(%d, &inputClarity);

switch(inputClarity);
{
case 1:
myDiamond.Clarity = F
break;

case 2:
myDiamond.Clarity = IF
break;

case 3:
myDiamond.Clarity = VVS1
break;

case 4:
myDiamond.Clarity = VVS2
break;

case 5:
myDiamond.Clarity = VS1
break;

case 6:
myDiamond.Clarity=VS2
break;

case 7:
myDiamond.Clarity = SI1
break;

case 8:
myDiamond.Clarity=SI2
break;

case 9:
myDiamond.Clarity = I1
break;

case 10:
myDiamond.Clarity = I3
break;

return 0;

}

}

PLEASE WRITE IN "C" l need help fixing my code because it does not work. Basically the teacher wants to test our knowledge of structures but we do not have to use all of them in the main functions. WE NEED TO WRITE TWO FUNCTIONS AT THE BOTTOM, PLEASE TRY AND NOT TO CHANGE THE TOP OF ALL THE STRUCTURES 1. In the first function I just need to say that my preferred choice of a Diamond retailer is Jared. Any other input besides Jared would say "No you need to go to Jared's, TRUST ME". IF IT IS JAREDS THEN I WANT IT TO SAY "GREAT, DO NOT GO ANYWHERE ELSE 2. I am trying to write a code that specifies the Diamonds certain Clarity. The clarity is described by the ones listed in the STRUCTURE. Which include F, IF, VVS1, VVS2, VS1, VS2, SI1, S12, 11, 13. These corresponding variables will be linked to 0,1,2,3,4,5,6,7,8,9. Then I want to ask the user to enter the number corresponding to the variable of the clarity. IF THE NUMBERS ARE FROM 0-3 THEN I WANT IT TO PRINT--> "YOU HAVE YOURSELF A WINNER" IF THE NUMBERS ARE FROM 4-7 THEN I WANT IT TO PRINT--> "YOU HAVE YOURSELF AN AVERAGE ONE" IF THE NUMBERS ARE FROM 8-9 THEN I WANT IT TO PRINT --> "YOU HAVE YOURSELF A LOSER" AND THATS IT THANKS!!

Explanation / Answer

#include <stdio.h>

enum eCut {

Round,

Princess,

Emerald,

Oval,

Marquise,

Pear,

Cushion,

Radiant,

Asscher,

Heart };

enum eClarity {

F,

IF,

VVS1,

VVS2,

VS1,

VS2,

SI1,

sI2,

I1,

I3 };

enum eColor   {

Colorless,

Near_Colorless,

Faint_Yellow,

Very_Light_Yellow,

Fancy_Yellow };

enum eSymmetry {

Off_Center_Culet,

Off_Center_Table,

Mishappened_Facets,

Off_Gridle,

Crown_Misalignment,

Wavy_Gridle   };

enum eAnatomy {

Table _Size,

Pavilion_Angle,

Gridle,

Depth };

enum eRetailers {

Tiffany,

Zales,

Kay,

Jared,

Johnson,

Zelberg,

Samuels,

Gordons };

struct sDaimond {

enum eCut Cut;

enum eAnatomy Anatomy;

enum eClarity Clarity;

enum eRetailers Retailer;

enum eColor Color;

enum eSymmetry Symmetry;

float carat;

float height;

float diameter;

float price;

int size;

int breakable;

char nameofretailer[][20] = { “Tiffany”,”Kay”,”Jared”,”Johnson”,”Zales”,”Zelberg”,”Samuels”,”Gordons”};

typedef enum eClarity clarityofdiamond;

typedef enum eRetailers Retailer; }

int main() {

Retailer mychoice;

printf(“Enter choice:”);

scanf(“%f ”,&mychoice);

printf(“My choice of a certain diamond retailer is: %s ”,nameofretailer[mychoice]);

if(mychoice == “Jared”) {

printf(“Great, do not go anywhere else! ”);

} else

{

printf(“No, you need to go to Jared’s,Trust Me”); }

clarityofdiamond myDiamond;

int inputclarity;

printf("Enter Clarity: ");

printf("The follwoing lines are the corresponding numerical values for the Clarity Variables: ");

    printf(" 0 = F ");

    printf(" 1 = IF ");

    printf(" 2 = VVS1 ");

    printf(" 3 = VVS2 ");

    printf(" 4 = VS1 ");

    printf(" 5 = VS2 ");

    printf(" 6 = SI1 ");

    printf(" 7 = SI2 ");

    printf(" 8 = I1 ");

    printf(" 9 = I3 ");

   scanf(%d, &inputclarity);

    switch(inputclarity)

   {

        case 1:

      myDiamond.Clarity = “F”;

        break;

         case 2:

        myDiamond.Clarity = “IF”;

        break;

         case 3:

        myDiamond.Clarity = “VVS1”;

        break;

         case 4:

        myDiamond.Clarity = “VVS2”;

        break;

         case 5:

        myDiamond.Clarity = “VS1”;

        break;

         case 6:

        myDiamond.Clarity=”VS2”;

        break;

         case 7:

        myDiamond.Clarity = “SI1”;

        break;

         case 8:

        myDiamond.Clarity=”SI2”;

        break;

         case 9:

        myDiamond.Clarity =” I1”

        break;

         case 10:

        myDiamond.Clarity =” I3”;

        break;

        Case Default : printf(“Invalid input”,inputclarity);

break; }

if (inputclarity == 0 ||inputclarity <3) {

printf(“You have yourself a Winner”);}

else if(4<inputclarity<7 ) {

printf(“You have yourself an average one”); }

else if(inputclarity == 8|| inputclarity == 9) {

printf(“You have yourself a loser”);   }

else printf(“Thanks”);

}