Answered step by step
Verified Expert Solution
Question
1 Approved Answer
CSE-1116 (Object Oriented Programming Laboratory) (A) Final Examination Time: 1 hour 30 minutes Monster class. Monsters have to eat food, Each Monster has weight. Eating
CSE-1116 (Object Oriented Programming Laboratory) (A) Final Examination Time: 1 hour 30 minutes Monster class. Monsters have to eat food, Each Monster has weight. Eating food increases is imper isintelligent() and andemed from an interface cailed Antil now. weight, isintelligen expectedHeighte). For interface called Animal. Animal has the methods bravery, and name are set during, false otherwise. For any human, the prints a screamster can anly scare humans who are "not brave". Every time scare is human scream from the human if he is not brave "not brave". Every time scare is called, it Sacryivonster can seere everyone except those if nor, print a scream and increase the scarecount variable by 1. by using the istritelli sere everyone except those who are not intelligent which it determines it scared. In this soare"(i) method. Every time scare is called, it prints the name of the human isintelligent(); if true, print the function, check if a human is intelligent or not by calling 1. Main Class Code's been glven below. Generate output for this code: Human human 1 = new Human("Jon", 70, "medium", "brave"); Human human2 = new Human("5am", 100, "high", "not brave"); CookieMonster co0 = new CookieMonster(100); //weight 100kg coo.scare(human1); coo.scare(human2); coo.eati): System.out.printin(coo); //prints weight and scareCount here ScaryMonster doggo a new ScaryMonster (500) : //weight is 500kg initially. oggo.eat(human1); oggo. eat(human2): ystem.out.println(dogigo): CSE-1116 (Object Oriented Programming Laboratory) (A) Final Examination Time: 1 hour 30 minutes Monster class. Monsters have to eat food, Each Monster has weight. Eating food increases is imper isintelligent() and andemed from an interface cailed Antil now. weight, isintelligen expectedHeighte). For interface called Animal. Animal has the methods bravery, and name are set during, false otherwise. For any human, the prints a screamster can anly scare humans who are "not brave". Every time scare is human scream from the human if he is not brave "not brave". Every time scare is called, it Sacryivonster can seere everyone except those if nor, print a scream and increase the scarecount variable by 1. by using the istritelli sere everyone except those who are not intelligent which it determines it scared. In this soare"(i) method. Every time scare is called, it prints the name of the human isintelligent(); if true, print the function, check if a human is intelligent or not by calling 1. Main Class Code's been glven below. Generate output for this code: Human human 1 = new Human("Jon", 70, "medium", "brave"); Human human2 = new Human("5am", 100, "high", "not brave"); CookieMonster co0 = new CookieMonster(100); //weight 100kg coo.scare(human1); coo.scare(human2); coo.eati): System.out.printin(coo); //prints weight and scareCount here ScaryMonster doggo a new ScaryMonster (500) : //weight is 500kg initially. oggo.eat(human1); oggo. eat(human2): ystem.out.println(dogigo)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started