
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN: 9780133594140
Author: James Kurose, Keith Ross
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question
Java program
use first name as Rick and last name as Smith
In yourLastNameArena.java:
1. define:
- 1 static variable: yourLastNameSlogan(string)
- 4 private instance variables: ArenaID(int),capacity(int),size(int),shape(String)
2. Defind following methods:
- getLTD(): return the last two digits of the ArenaID as an integer; getLTC(): return the last two characters of the value in variable yourLastNameSlogan as a String.
- getShape(): return the shape of the Arena. We assume that each character is associated with a weight based on their position in the alphabet table. The weight of ‘a’ is 1, the weight of ‘b’ is 2, the weight of ‘c’ is 3, so on and so forth, the weight of ‘y’ is 25 and the weight of ‘z’ is 26. For example, if the result of getLTC() is “ab”, then the weight of “ab” is 3. Based on the above information, if the weight of the getLTC() is less or equal to 26, the getShape() method will return “Circle”; otherwise, return “Square”.
- Constructors:
- Default constructor: set yourLAstNameSlogan as "yourFirstName works!"; set capacity as 50, set ArenaId as 2222, set size as 20, and set shape properly
- Constructor with inputs: capacity, size and ArenaID; set yourLastNameSlogan as "yourFirstName works!"; this constructor should initialize all instance variables properly.
- arenaType(): return a String based on the Capacity of the Arena. If the capacity is less than or equal to 4000, return “Small”; if the capacity is larger than 4000 but less than or equal to 7000 return “Medium”; else return “Large”.
- arenaArea(): return the area value (a double) based on the shape of the Arena. Assume that the size is the Arena radius if shape is circle, otherwise size is the side length if the shape is square.
- crowdLevel(…): the parameter of this method is an integer indicating the number of people in the Arena now, while the return of this method is a double x/Area(), where x is the parameter (i.e., the number of people in the Arena now). Make sure to check if x is under the Arena capacity. Show warning messages if x is over the Arena capacity.
- showArenaSeatingDiagram (): this method uses while-loop to create a triangle; The letter to print at each position is 2; the length and height of the triangle are the number of letters in the instance variable of yourLastNameSlogan. For example, for “M Jordan”, if yourLastNameSlogan is “M work” this will print out:
222222
22222
2222
222
22
2
In yourFirstNameOrganization.java:
1. in the main method:
- do the following operations:
- Create an array of YourLastNameArena object and each object has a capacity of a random capacity a random number between 0 and 7000; the array length should be 25. For each object in the array, make sure that the ArenaID is set as: 1234 + index_of_the_object_in_the array while the size is 50.
- Find the Arena object with the smallest capacity; call its showArenaSeatingDiagram() and crowdLevel(4000).
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps with 1 images

Knowledge Booster
Similar questions
- Write a Java class named PhoneRecord.java that performs the following functions: The class should contain the following data attributes and methods: private String name - The customer's name private String number - The customer's phone number public PhoneRecord(String personName, String phoneNumber) - Constructor get/set Methods - For each data attribute public String toString( ) - Special method to be used when printing a phoneRecord object Thank you so much for your help. Trying to write this class has really been stumping me.arrow_forwardIn Java Write a Fraction class that implements these methods:• add ─ This method receives a Fraction parameter and adds the parameter fraction to thecalling object fraction.• multiply ─ This method receives a Fraction parameter and multiplies the parameterfraction by the calling object fraction.• print ─ This method prints the fraction using fraction notation (1/4, 21/14, etc.)• printAsDouble ─ This method prints the fraction as a double (0.25, 1.5, etc.)• Separate accessor methods for each instance variable (numerator , denominator ) in theFraction classProvide a driver class (FractionDemo) that demonstrates this Fraction class. The driver class shouldcontain this main method : public static void main(String[] args) { Scanner stdIn = new Scanner(System.in); Fraction c, d, x; // Fraction objects System.out.println("Enter numerator; then denominator."); c = new Fraction(stdIn.nextInt(), stdIn.nextInt()); c.print(); System.out.println("Enter numerator; then denominator."); d = new…arrow_forwardJavaarrow_forward
- JAVA Design a class named MyInteger. The class contains: An int data field named value that stores the int value represented by this object. A constructor that creates a MyInteger object for the specified int A get method that returns the int Methods isEven(), isOdd(), and isPrime() that return true if the value is even, odd, or prime, respectively. Static methods isEven(int), isOdd(int), and isPrime(int) that return true if the specified value is even, odd, or prime, respectively. Method equals(int) that return true if the value in the object is equal to the specified value.arrow_forwardThe class Shapes includes two void methods: calcTriangleArea( ) and calcTrianglePerimeter( ). The calcTriangleArea ( ) method takes two int parameters (base and height), calculates the area of a triangle, and assigns the value to a private instance variable (area). The calcTrianglePerimeter( ) method takes three int parameters (lengthSide1, lengthSide2, and lengthSide3), calculates the perimeter of a triangle, and assigns the value to a private instance variable (perimeter). The Shapes class also includes two getter methods, which return the calculated values. The Shapes class implements the Calculatable interface.Write the Shapes class and the Calculatable interface.arrow_forwardInheritanceDemo.java: // StudentName Today's Date public class InheritanceDemo { public static void main(String[] args) { KleenexBox kb1 = new KleenexBox(); KleenexBox kb2 = new KleenexBox(100); Box justABox = new Box(); System.out.println("justABox has area " + BoxArea(justABox)); System.out.println("kb1 has area " + BoxArea(kb1)); System.out.println("kb2 has this many square inches of tissue: " + KleenexArea(kb2)); } public static double BoxArea (Box b) { return b.width * b.length; } public static double KleenexArea (KleenexBox a) { return a.width * a.length * a.numTissues; } } Box.java: // Student Name Today's Date public class Box { public double width; public double length; public String label; } KleenexBox.java: // Student's Name Today's Date public class KleenexBox extends Box { public int numTissues; // A new Kleenex box public KleenexBox() { numTissues = 50; length = 8.0; width = 5.0; } // A new Kleenex box with a specific number of tissues public…arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY

Computer Networking: A Top-Down Approach (7th Edi...
Computer Engineering
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:PEARSON

Computer Organization and Design MIPS Edition, Fi...
Computer Engineering
ISBN:9780124077263
Author:David A. Patterson, John L. Hennessy
Publisher:Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:9781337569330
Author:Jill West, Tamara Dean, Jean Andrews
Publisher:Cengage Learning

Concepts of Database Management
Computer Engineering
ISBN:9781337093422
Author:Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:9780133750423
Author:VENIT, Stewart
Publisher:Pearson Education

Sc Business Data Communications and Networking, T...
Computer Engineering
ISBN:9781119368830
Author:FITZGERALD
Publisher:WILEY