Assuming the following enum declaration exists:
enum Dog { POODLE, BOXER, TERRIER }
what will the following statements display?
- a. System.out.println(Dog.POODLE + “\n” +
Dog.BOXER + ”\n” +
Dog.TERRIER);
- b. System.out.println(Dog.POODLE.ordinal() + ”\n” +
Dog.BOXER.ordinal() + ”\n” +
Dog.TERRIER.ordinal ());
- c. Dog myDog = Dog.BOXER;
if (myDog.compareTo(Dog.TERRIER) > 0)
System.out.println(myDog + “ is greater than ” +
Dog.TERRIER);
else
System.out.println(myDog + “ is NOT greater than ” +
Dog.TERRIER);
Want to see the full answer?
Check out a sample textbook solutionChapter 8 Solutions
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
Additional Engineering Textbook Solutions
Objects First with Java: A Practical Introduction Using BlueJ (6th Edition)
Software Engineering (10th Edition)
Starting Out With Visual Basic (8th Edition)
Problem Solving with C++ (9th Edition)
C Programming Language
Starting Out with Python (4th Edition)
- struct gameType { string title; int numPlayers; bool online; }; gameType Awesome[50]; Write the C++ statements that print out all gameType fields from Awesome whose numPlayers is > 1.arrow_forwardLook at the following declaration:enum Flower { Rose, Daisy, Petunia } What is the name of the data type?arrow_forwardIn Pascal language When you have declared an enumerated type, you can declare variables of which type?arrow_forward
- نقطة واحدة Let A = {a; b; c; d} and R= {(a; a); (b; c); (c; b); (d; d)} then R is Transitive Equivalent not transitivearrow_forwardNonearrow_forwardCan you answer it according to the code below #include #define MAX_EMP 5 struct Employee { int id; int age; float salary; }; int count = 0; struct Employee emp[MAX_EMP]; void display() { printf("\n---=== EMPLOYEE DATA ===---\n"); printf("EMP ID\tEMP AGE\tEMP SALARY\n"); printf("======\t=======\t==========\n"); for(int i = 0; i < count; i++) { printf("%d\t%d\t%.2f\n", emp[i].id, emp[i].age, emp[i].salary); } } void add() { if(count == MAX_EMP) { printf("\nERROR!!! Maximum Number of Employees Reached\n"); return; } printf("\nAdding Employee ===============\n"); printf("Enter Employee ID: "); scanf("%d", &emp[count].id); printf("Enter Employee Age: "); scanf("%d", &emp[count].age); printf("Enter Employee Salary: "); scanf("%f", &emp[count].salary); count++; } void update() { int id, found = 0; float newSalary; printf("\nUpdate Employee Salary…arrow_forward
- int func(int a, int b) { return (aarrow_forwardAssume the Product structure is declared in c++ as follows:struct Product{string description; // Product descriptionint partNum; // Part numberdouble cost; // Product cost}; Now write a definition for an array of 100 Product structures. Do not initialize the array. ( Drop screenshot of output as well )arrow_forwardComplete the following code and then generate an equivalent code in python.arrow_forwardStatic Variable: a variable whose lifetime is the lifetime of the program (static int x;) Dynamic Variable: It is a pointer to a variable (int *x;) Is this comparison true?arrow_forwardQuestion Write a C++ program that follows the program requirements in the document providedarrow_forwardDETERMINE THE OUTPUT OF THE CODE: #include using namespace std; int main() { int i; for (i = 0; i > 10; i++){ %D {cout << i <<" "; } } return 0; }arrow_forwardarrow_back_iosSEE MORE QUESTIONSarrow_forward_ios
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningEBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT