462 Topics

Member Avatar for
Member Avatar for Griff0527

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 …

Member Avatar for raptr_dflo
0
374
Member Avatar for mags11

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 …

Member Avatar for stultuske
0
12K
Member Avatar for greatman05

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 …

Member Avatar for Ancient Dragon
0
207
Member Avatar for shywolf91

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 …

Member Avatar for Topi Ojala
0
166
Member Avatar for dsmith12

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 …

Member Avatar for NormR1
0
442
Member Avatar for Danielhuo

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 …

Member Avatar for Danielhuo
0
201
Member Avatar for wonderlandslost

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, …

Member Avatar for wonderlandslost
0
303
Member Avatar for Jetster3220

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 …

Member Avatar for Gribouillis
0
229
Member Avatar for Kanoisa

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 …

Member Avatar for Kanoisa
0
192
Member Avatar for iRamble88

[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 …

0
172
Member Avatar for dsmith12

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 …

Member Avatar for stultuske
0
216
Member Avatar for jpsider

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 …

Member Avatar for Philippe.Lahaie
0
9K
Member Avatar for badboy11

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 …

Member Avatar for badboy11
0
253
Member Avatar for swy

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 …

Member Avatar for NormR1
0
222
Member Avatar for 3nrichedd

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 …

Member Avatar for stultuske
0
207
Member Avatar for Jnk

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 = …

Member Avatar for Jnk
0
455
Member Avatar for emidevil

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 …

Member Avatar for DavidKroukamp
0
573
Member Avatar for 3nrichedd

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 …

Member Avatar for hiddepolen
0
251
Member Avatar for Hypnos_16

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 …

Member Avatar for NormR1
0
2K
Member Avatar for Eragah

[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 …

Member Avatar for Eragah
0
212
Member Avatar for creative_m

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.

Member Avatar for creative_m
0
470
Member Avatar for connect2abhi

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

Member Avatar for DavidKroukamp
0
12K
Member Avatar for prakhar_cool

[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 …

Member Avatar for rubberman
0
268
Member Avatar for xxvicoxx

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 …

Member Avatar for jeff-fisher
0
1K
Member Avatar for biogig

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. …

Member Avatar for daviddoria
0
201
Member Avatar for Labdabeta

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: …

Member Avatar for Labdabeta
0
144
Member Avatar for FEC

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 …

Member Avatar for Kanoisa
-1
379
Member Avatar for Reeseoo

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 …

Member Avatar for Reeseoo
0
528
Member Avatar for Kunal0

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 …

Member Avatar for ravenous
0
282
Member Avatar for Labdabeta

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 …

Member Avatar for Labdabeta
0
167

The End.