462 Topics
| |
| I am getting an error during the build stating: "Illegal call of non-static member function" and I cannot figure out 1) what does this mean, or 2) how to resolve it. For detailed clarification, I will type out what the assignment was (I say was because the assignment was due … |
I am trying to figure out this one out. The directions: Write a class named car in the following fields: [LIST=1] [*]yearModel - The yearModel field is an int that holds the car's yea model. [*]make - The make field references a String object that holds the make of the … | |
So, I'm a bit confused with how inheritance works in relation to variables. Let's say that I had the following class: class Test { private: int var1; float var2; public: void getInfo(int,float); void setStuff(int,float); }; Now, let's suppose that I wanted to derive a class from that base class; I … | |
Here is my code: [CODE] #include <iostream> #include <string> #include <cstring> using namespace std; //() char openedP='('; //open ( char closedP=')'; //close ) //end () //dash char dash='-'; //end dash class PhoneNumber { int countryCode; int areaCode; int number; char type; int year; public: PhoneNumber() { countryCode = 43; areaCode … | |
I want the program to compare what the user puts in and then compare that string to something in an array and see if it is a match. Here is code for things already put into array [CODE]private static void createExistingUserData(Scientist[] scientist){ scientist[0] = new Scientist("user1", "password1"); scientist[0].setDob("02/02/1995"); scientist[0].setSsn("612-45-7070"); scientist[0].setApplicantName("Peter … | |
Hi, experts: I am very to c++, and here is a program that should: • create a Customer object– (although you will only be using one constructor here, be sure and test all three) • Display the Customer’s info using the ‘get’ functions • Ask the user how many months … | |
So my instructor assigned us to create a program that calculates the area and stores that, along with coordinates, in an array. This has to be done for both triangles and squares. He is having us use separate classes for the project; the main Drawer class, parent class, square class, … | |
I am really struggling with a Python classes project. Here are the directions Design and implement a class called Dog that contains attributes (data) representing the dog’s name and age. Define the Dog constructor to accept and initialize that data. Include one method that will reset the dog’s age, one … | |
Hi all, I have started finding lots of uses for abstract classes to define interfaces for common functionality using polymorphism and i know that using polymorphism and virtual functions incurrs some additional call cost of functions. So what im wondering is can i get the best of both worlds? consider … | |
[CODE=java]import java.util.Scanner; class Sum { private int value; public int get() { return value; } public void set(int sum) { this.value = sum; } } class Summation extends Thread { private int upper; private int lower; private Sum sumValue; public Summation(int upper, Sum sumValue) { if (upper < 0) throw … | |
So my code is suppose to get information from the user and figure out how much funding the two professors get. My code runs twice but for some reason only the last entry is saved and outputted and my formula for calculating the new funding only outputs zero for some … | |
Hi all, I'm working on a school project and I am running into a problem, possibly more... This is my first post, so I am sorry if it ends up ugly. Here is a description of the project: This project focuses on demonstrating your understanding of classes and objects. Before … | |
Need help with implementing a pure abstract class via inheritance, using namespace to wrap all my classes to avoid conflict with others. I have been able to build and run the code successfully if I remove namespace wrapper from my abstract class and all classes that inherit from my pure … | |
I'm trying to read in the following text file: Jim Nasium mgr Fitness & Leisure 45000 Lazy Susan mgr Home Furnishings 55000 Gene Theory mgr Fine Jewelry 10000 And I have the following code: public abstract class Employee { private String name; private double grossPay; private double netPay; private final … | |
Working on this program that uses 2 classes and a client program to test them, I keep getting this error pointing at my constructor, not sure what i am doing wrong but could use some assistance if anyone is able to offer, the error i am getting is: cannot find … | |
Hello I am a new to C++ and have some questions. I have two classes called Point and Square like this: [CODE] class Point { int x, y; public: int getx() const { return x; } int gety() const { return y; } Point(int a, int b) { x = … | |
Hi. im kinda new here . i just want some help with this code i cant seem to figure out my problem, i already declared a constructor but it keeps on saying cannot find symbol when i compile it -_- import javax.swing.JOptionPane; import java.io.*; public class Sample_Thread { public static … | |
I am working on this assignment in my java class, and am running into a few problems. Basically there are 2 classes and a main/client program that tests the classes. there is 1 superclass and a subclass that extends the superclass.. I have 2 constructors in my superclass but when … | |
Hello All, I'm trying to create three independent animations that all occur in one main frame. I have to use the following methods in my code [CODE]--- Animate --- public interface Animate { void move( double x, double y); void changeConfiguration(); } --- Drawable ----- import java.awt.Graphics2D; public interface Drawable … | |
[B][I]Hi I wanted to ask a quick question. I have two classes. And within my main class i am able to pass in variable to three variables EyeColorR to EyeColorB and able to send them the my Eye Class under the consturctor class Eye. the catch is I need to … | |
I wonder why they use private constructors.when I was navigating java documentation I found alot of classes with private constructor.Would you tell me what are the benefits of writting them. | |
Hi Can any one tell me how to call a subclass method from a superclass? For example: I have a class A,B and C. Now B and C extends A. So is there any way that we can call a method of B in A? Thanks Abhishek | |
[CODE]#include <iostream> using namespace std; class X{ public: int p; }; int main(){ int b; X obj; int X::*ptr = &X::p; obj.p = 100; cout<<obj.p<<endl; cout<<ptr<<endl; cout<<obj.*ptr<<endl; system("pause"); return 0; }[/CODE] When i run this program, i get the output as: 100 1 100. I understand why it shows 100...but … | |
Hello guys well I have been working in this arraylist that is now driving me crazy! Bascially I wrote a CAR class which has some methods in it, however now I created an arraylist so it could store cars from the other class and at the same time have access … | |
guys I've been trying to write this lab for my comp sci class for three days now. i've got to the point where it compiles but when I try to run it a table pops up that's says there's an error somewhere in the program that causes it to abort. … | |
I have a function that takes a reference to an interface class as a parameter. I have created a derived class from the interface class, but when I try to call the function with an instance of my derived class as an argument I get a compiler error saying "error: … | |
Hi am trying to write a program and its giving me this error "cannot instantiate abstract class", can someone help me please? this is the code: Header: [CODE]#ifndef ABSTRACTGEOMETRICOBJECT_H #define ABSTRACTGEOMETRICOBJECT_H #include <string> using namespace std; class GeometricObject { public: GeometricObject(); GeometricObject(string color, bool filled); public: string getColor(); void setColor(string … | |
Hi all new to this forum, just thought i'd post in here because i am having a bit of trouble with an assignment... basically i have this class in a header file called Product.h... [CODE] class Product { private: int _id; unsigned int _price; public: }; [/CODE] I access this … | |
Hi, I have a basic understanding of C++ and was creating something myself with a class of 6 integers and a string what I want to do is to be able to find the mode values for each of the six integers and strings I have instantiated a set of … | |
I have been teaching myself algorithms and I am stuck with the AlphaBeta AI algorithm. I want to test my knowledge of it with a TicTacToe simulation. The thing is I want it to be easy to modify for any two player game and I cannot figure out how to … |
The End.