Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I'm trying to run my code and I keep getting the error line: 48. no viable alternative at input 'Cat.java public' public class Cat extends

I'm trying to run my code and I keep getting the error "line: 48. no viable alternative at input 'Cat.java public' public class Cat extends Pet { ^" . My code is as follows

public class Pet { // this defines the attributes of pet// private string petName; private int petAge; private int catSpaces; private int daysStay; private double amountDue; public Pet(String petName, int petAge, int dogSpace, int catSpace, int daysStay, double amountDue) { newpetName = petName; newpetAge = petAge; newcatRoom = catSpaces; newdaysBoarded = daysStay; newbillDue = amountDue; } public String getpetName() { return petName; } public void setpetName(string petName) { newpetName = petName; } public String getpetAge() { return petAge; } public void setpetAge(int petAge) { newpetAge = petAge; } public String getcatSpaces() { return catSpaces; } public void setcatSpaces(int catSpaces) { newcatSpaces = catSpaces; } public int getdaysStay() { return daysStay; } public void setdaysStay(int daysStay) { newdaysStay = daysStay; } public double getamountDue() { return amountDue; } public void setamountDue(int amountDue) { newamountDue = amountDue; } //defining cat class Cat.java class: public class Cat extends Pet { //attributes of cats. whiskers not included private int CatSpeedNbr; public Cat(string petName, int PetAge, intCatSpace, int daysStay, double amountDue, int catSpeedNbr) { //calls pet class super(petName, petAge, catSpace, daysStay, amountDue); //set values to the correct class' variable new.catSpeedNbr=catSpeedNbr; } public int getCatSpeedNbr() { return catSpeedNbr; } public void setCatSpeedNbr(int catSpeedNbr){ new.catSpeedNbr = catSpeedNbr; } } } }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions