what is the problem here
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package testcylinder;
/**
*
* @author imtia
*/
public class TestCylinder {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
int r = 43;
int h = 16;
Cylinder c1 = new Cylinder(r,h);
Cylinder c2 = new Cylinder(r,h);
System.out.println("Cylinder-1: "+c1.getVolume());
System.out.println("Cylinder-2: "+c2.getVolume());
maze(c1,c2);
System.out.println("After Update :");
System.out.println("Cylinder-1: "+c1.getVolume());
System.out.println("Cylinder-2: "+c2.getVolume());
}
public static void maze(Cylinder c1, Cylinder c2)
{
c1.height = c2.height/2;
c2.height = c2.height/3;
c1 = c2;
c1.radius = 10;
c2 = new Cylinder (10,10);
}
}
public class Cylinder {
int radius, height;
public Cylinder(int radius, int height){
this.radius = radius;
this.height = height;
}
public int getVolume(){
return (int)(3.14*radius*radius*height);
}
}
Step by stepSolved in 3 steps with 1 images
- Can you please help with this Use the provided template below BASE_YEAR = 1903 #***************************************************************# Function: main# # Description: The main function of the program## Parameters: None## Returns: Nothing ##**************************************************************def main():# Local dictionary variablesyear_dict = {}count_dict = {}developerInfo()# Open the file for readinginput_file = open('Program11.txt', 'r') # End of the main function #*********************************************## Function: # # Description: ## Parameters:## Returns: ##*****************************************def showResults(year_dict, count_dict):# Receive user inputyear = int(input('Enter a year in the range 1903-2018: ')) # Print resultsif year == 1904 or year == 1994:print("The world series wasn't played in the year", year)elif year < 1903 or year > 2018:print('The data for the year', year, \'is not included in our database.')else:winner = year_dict[year]wins…arrow_forwardImplement a nested class composition relationship between any two class types from the following list: Advisor Вook Classroom Department Friend Grade School Student Teacher Tutor Write all necessary code for both classes to demonstrate a nested composition relationship including the following: a. one encapsulated data member for each class b. inline default constructor using constructor delegation for each class c. inline one-parameter constructor for each class d. inline accessors for all data members e. inline mutators for all data membersarrow_forwardpackage lab1; /** * A utility class containing several recursive methods * * <pre> * * For all methods in this API, you are forbidden to use any loops, * String or List based methods such as "contains", or methods that use regular expressions * </pre> * * */ public final class Lab1 { /** * This is empty by design, Lab class cannot be instantiated */ privateLab1(){ // empty by design } /** * Returns the product of a consecutive set of numbers from <code> start </code> * to <code> end </code>. * * @param start is an integer number * @param end is an integer number * @return the product of start * (start + 1) * ..*. + end * @pre. * <code> start </code> and <code> end </code> are small enough to let * this method return an int. This means the return value at most * requires 4 bytes and no overflow would happen. */ publicstaticintproduct(ints,inte){ if(s==e){ returne; }else{ returns*product(s+1,e); } }…arrow_forward
- Written in Python with docstring please if applicable Thank youarrow_forwardProgram #11. Show the ArrayStackADT interface 2. Create the ArrayStackDataStrucClass<T> with the following methods: default constructor, overloaded constructor, copy constructor, initializeStack, isEmptyStack, isFullStack, push, peek, void pop 3. Create the PrimeFactorizationDemoClass: instantiate an ArrayStackDataStrucClass<Integer> object with 50 elements. Use a try-catch block in the main( ) using pushes/pops. 4. Exception classes: StackException, StackUnderflowException, StackOverflowException 5. Show the 4 outputs for the following: 3,960 1,234 222,222 13,780arrow_forwardIn C++ Create a new project named lab9_1 . You will need to implement a Course class. Here is its UML diagram: Course - department : string- course_num : string- section : int- num_students : int- is_full : bool + Course()+ Course(string, string, int, int)+ setDepartment(string) : void+ setNumber(string) : void+ setSection(int) : void+ setStudents(int) : void+ getDepartment() const : string+ getNumber() const : string+ getSection() const : int+ getStudents() const : int+ print() const : void Create a sample file to read from: CSS 2A 1111 35 Additional information: The Course class has two constructors. Make sure you have default values for your default constructor. Each course maxes out at 40 students. Therefore, you need to make sure that there aren’t more than 40 students in a Course. You can choose how you handle situations where more than 40 students are added. Additionally, you should automatically set is_full to false or true, based on the number of…arrow_forward
- In C++ Create a new project named lab8_1. You will be implementing two classes: A Book class, and a Bookshelf class. The Bookshelf has a Book object (actually 3 of them). You will be able to choose what Book to place in each Bookshelf. Here are their UML diagrams Book class UML Book - author : string- title : string- id : int- count : static int + Book()+ Book(string, string)+ setAuthor(string) : void+ setTitle(string) : void+ print() : void+ setID() : void And the Bookshelf class UML Bookshelf - book1 : Book- book2 : Book- book3 : Book + Bookshelf()+ Bookshelf(Book, Book, Book)+ setBook1(Book) : void+ setBook2(Book) : void+ setBook3(Book) : void+ print() : void Some additional information: The Book class also has two constructors, which again offer the option of declaring a Book object with an author and title, or using the default constructor to set the author and title later, via the setters . The Book class will have a static member variable…arrow_forwardFix this code for any errorsarrow_forwardin c++ codearrow_forward
- Current file: Team.java Load default template... 1 public class Team { // TODO: Declare private fields - name, wins, losses 2 3 4 5 // TODO: Define mutator methods // setName(), setWins(), setLosses() 7 8 // TODO: Define accessor methods // 9. 10 getName(), getWins(), getLosses() 11 12 13 // TODO: Define getWinPercentage() 14 15 16 // TODO: Define printStanding()arrow_forwardJava programming - please see attched image for initial instruction before the following below. Write a subclass of VowelSeparator that adds three additional methods and a constructor. The class should be named VowelSeparatorAndCounter. Here are the methods to add: void setString(String s) This method should replace the string stored by the object with s. If the argument is null then the method should throw an IllegalArgumentException. (This is an unchecked exception) int getVowelCount() This method should return the number of vowels in the string.int getNonVowelCount() This method should return the number of characters in the string that are not vowels. Write a static method that accepts an array of VowelSeparatorAndCounter objects and returns the total number of vowels contained in all of them. It should have the following signature: public static int totalVowelCount(VowelSeparatorAndCounter[] a)arrow_forwardjava 1 error with my code pls help correct my codearrow_forward
- 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