128 Topics

Member Avatar for
Member Avatar for penguins10

Hi, I have a homework assignment that I just cannot figure out. I would be grateful of any help. The assignment is: Create a program which: Implements a class called Queue: The class should contain an array of maxQ integers. There should be two constructors: One that takes no argument …

Member Avatar for Zeeshan Cheema
0
239
Member Avatar for incubus9x9

Please dont tell me to "google" it obviously I'v tried everything and this is my last resort. k thanks :) ok so I have to set a value to be restricted in the constructor ___________ Modify the constructor and set methods of the Shape class to verify the values of …

Member Avatar for seanbp
0
202
Member Avatar for Slyvr

I'm working on a really basic text editor to save and open txt files. On my text area setLineWrap, it's giving me a "misplaced constructs" and "delete token" for the period and (true) For why? [CODE]/**Matthew Schrum *11/18/2010 */ import java.awt.*; import javax.swing.*; import javax.swing.border.*; import java.awt.event.*; import java.io.File; import …

Member Avatar for Slyvr
0
275
Member Avatar for Obsidian_496

Hello. I have a problem with one part of my homework. I'm not exactly sure how to say this in English. I want the constructor to build an object and assign string values to attribute1 and attribute2. I'm only posting the relevant part of my code. My class can be …

Member Avatar for Ancient Dragon
0
2K
Member Avatar for geethasree

Hi All, this is my first query after joining the forum. I would like to know following points: 1. If I can create threads in constructor 2. If yes, can I use the same object / instance (which created this thread)in this thread to call other methods of the class …

Member Avatar for geethasree
0
2K
Member Avatar for ace8957

Hi all, So I'm working on this program to use a circular doubly linked list to implement a queue class. It went fairly well, but I'm stuck on the copy constructor, which causes runtime errors whenever I try to test it. Nonetheless, I really don't see what I am doing …

Member Avatar for caut_baia
0
2K
Member Avatar for notuserfriendly

I am reading from a file. After i tokenize and assign each value to a string field i call the constructor and initialize the object. next i want to add them to an array. I have done this with a vector and all i do is [CODE=java]ObjectVec.add(obj1);[/CODE] Mind you this …

Member Avatar for masijade
0
171
Member Avatar for Garrett2011

Is there any way to inline just some selective calls to a particular function not all of them? by function I also mean class operators like assignment operator, constructors like copy constructor. The only form I know is declaring function as such at beginning and that's supposed to effect all …

Member Avatar for Narue
0
148
Member Avatar for aviavyne

Hello It's me again, some might have seen a similar string, and it is probably because it is the same, but with a different problem. The following shows a program which uses a function that converts Fahrenheit into Celsius. The problem is that a person can enter any value they …

Member Avatar for NathanOliver
0
193
Member Avatar for Xufyan
Member Avatar for BboyRodimus

I'm writing two classes for the main program code. I'm stuck trying to do figure out how to instantiate an object of the class Address: [B]Address class:[/B] [CODE]public class Address { private String city; private String state; public Address() { city = "?"; state = "?"; } public Address(String aCity, …

Member Avatar for sneaker
0
1K
Member Avatar for oscarp

Hi, I have a map of a base class object (not pointer to objects). I did this because I need to have inheritance from others types like this: Parameter RealParameter: Parameter IntParameter: Parameter ... My problem is that when I am going to insert in the map, copy constructur of …

Member Avatar for mike_2000_17
0
2K
Member Avatar for Xufyan

Is it possible to call a constructor if we entered know value in the output screen ??? example !! [CODE]import java.io.*; class Employee{ int num; static int count=0; float compensation; public void print(){ System.out.println ("Employee number: " + num + ", Employee Compensation: $" + compensation); } public Employee(){ num …

Member Avatar for group256
0
191
Member Avatar for Xufyan

I got to assignment first one was to print the data of two students using different classes and constructors and count the total numbers of records and i've done this. here is the program. [CODE]public class Student { int RollNo; String name; static int stdcount=0; public void print(){ System.out.println ("Roll …

Member Avatar for NormR1
0
833
Member Avatar for majestic0110

I just wanted to demonstrate a quick point regarding Constructors & inheritance. Look at these two classes and think about what you might expect to see after the main method has run. Notice that ClassB is a subclass (inherits from) of ClassA. So, what do we expect the output to …

Member Avatar for masijade
3
578
Member Avatar for jackabascal

It may seem like a simple answer, but how do I pass an image to a bitmaps constructor. for example: [CODE]Bitmap bmp = new Bitmap(########);[/CODE] what would I put in place of the pound signs If i wanted the default image to be C://Users/Me/Documents/Visual Studio 2010/Projects/MyProject/Image.jpg Please help.

Member Avatar for Geekitygeek
0
184
Member Avatar for crodriguez08

Hey there, I need some help with the placement of constructors and how the second constructor would work (there's two of them). All I ask is for some explanation. These are the exact instructions: The default Constructor should build a dynamic array of size 3 for the grades. Another constructor …

Member Avatar for crodriguez08
0
464
Member Avatar for Garrett2011

take following class and two object definitions: [CODE=c++] class Rect{ public: enum centimeter; enum meter; Rect(double len,double wid,enum centimeter){ length=(len/100); width=(wid/100); } Rect(int len,int wid,enum meter){ length=len; width=wid; } //rest of implementation private: double length;//in meters double width;//in meters }; Rect obj1(10,5,Rect::centimeter()); Rect obj2(10,5,Rect::meter());[/CODE] two previous constructors have dummy enum …

Member Avatar for Garrett2011
0
2K
Member Avatar for Garrett2011

take two following classes and their constructors as samples: [CODE=c++] class One{ public: One(int a,int b):adad1(a),adad2(b){} private: int adad1; int adad2; }; class Two{ public: Two(int input[]){ for (int i=0;i<10;i++) araye[i]=input[i]; } private: int araye[10]; };[/CODE] considering objects with static storage duration, I think first constructor can be applied during …

Member Avatar for Garrett2011
0
303
Member Avatar for Garrett2011

Suppose we have following two classes: [CODE=c++] class Temp{ public: char a; char b; }; class Final{ private: int a; char b; char c; public: Final(Temp in):b(in.a),c(in.b){} //rest of implementation };[/CODE] can we initialize an object of the Final class with following syntax in upcoming c++0x standard: [CODE=c++] Final obj(Temp{'a','b'});[/CODE]

Member Avatar for mike_2000_17
0
249
Member Avatar for aragmus

hi guys what constructors should i use for this program? [CODE]using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace BACKUPEXEFILES { public class cCOPY { private string _directorypath; private string _filename; public string directorypath { get { return _directorypath; } set { _directorypath = value; } } public string filename …

Member Avatar for k.d.m
0
125
Member Avatar for pi_lord12

Ok, so I'm trying to make a constructor for a text-based game for a monster. Here is the code for it: [CODE]public class Methods { String name; //characteristics of monsters int bodyPoints, mindPoints, attack, defense; public Monster(String name, int bodyPoints, int mindPoints, int attack, int defense) { this.name=name; this.bodyPoints=bodyPoints; this.mindPoints=mindPoints; …

Member Avatar for pi_lord12
0
2K
Member Avatar for abhi74k
Member Avatar for abhi74k
0
146
Member Avatar for iamcreasy

This class when, it is not integrated with the main program, shows the following error....and I have no idea what it is trying to say.. :( :( [code] #include "character.h" Character::Character(DrawEngine *de, int s_index, float x, float y, int lives, char up_key, char down_key, char left_key, char right_key) : Sprite(de, …

Member Avatar for iamcreasy
0
154
Member Avatar for sah15

Hi, I'm supposed to create a program where I want to purchase tickets to a theater based on rows and columns of the seats. The program uses two-dimensional arrays and constructors, and is supposed to display somethine like this: "ASU Gammage Theater 1. View available seats 2. Request tickets 3. …

Member Avatar for Lerner
0
229
Member Avatar for maddav

Hi, just a quick question (i hope!!), i'm working on an assignment where i need to build a user-defined library of shapes. The class structure is to have "shape" as a base-class with both 2d and 3d shapes as derived classes. I've handled this by storing them in a vector …

Member Avatar for maddav
0
616
Member Avatar for Kevin_160

Hi Everybody, I have succeeded in parsing the values I needed from a text file and storing them in an array. The script I've posted works as a function, but now I tried to put it in a class and I can't figure out how to define the constructor. The …

Member Avatar for mrnutty
0
2K
Member Avatar for DarkT

Hi everyone. We were given a homework to code a hash table. The objects and their members were given by our professor and we were only supposed to implement the functions (Add, Remove, Contains and Print), so I shouldn't change the objects. I should also do a copy constructor and …

Member Avatar for DarkT
0
2K
Member Avatar for sah15

I'm having troubles with a code for a program (involving classes) where I am supposed to input the three sides of a triangle and the program determines whether the triangle is a right triangle, equilateral, isosceles, and scalene, etc. I have only one error preventing me from compiling my program, …

Member Avatar for Ancient Dragon
0
1K
Member Avatar for corby

hi in my drive file this is what my constructor looks like. im passing an array to it the constructor so that i can assign it to set[num]. what i want to know is what would this look like in the header file? drive-file: [CODE]IntegerSet::IntegerSet( int a[]) { for ( …

Member Avatar for Sodabread
0
199

The End.