462 Topics

Member Avatar for
Member Avatar for jongiambi

Can anyone help me with this constructor problem? In main: instantiate one date object (date1) using the default constructor just to see that the constructor works, print the month, day, and year of date1 using the getters get input from the user and use the setters to set the values …

Member Avatar for jongiambi
0
403
Member Avatar for rahul.ch

import java.io.*; public class Mac extends Laptop { public static void main(String r[]) { new Mac().crunch(); } //insert code here } class Laptop { void crunch() throws IOException { } } The question is simple. Insert a code that will make the program compile. Answers are: `void crunch()` or `void …

Member Avatar for NormR1
0
215
Member Avatar for rahul.ch

int [] ia1 = {1,2,3}; int [][] ia2; Object o = ia1; ia2 = new int [3][3]; ia2[0] = (int[])o; ia2[0][0] = (int[])o; Answer is "Compilation fails in last line" Explanation: Arrays are objects, and that each array dimension is a separate type. So, for instance, ia2 is of type …

Member Avatar for stultuske
0
211
Member Avatar for Dendei

hey i have a question how do i get my funktion to work in the design.cs? namespace Visma_projekt { public class BlackJack { public string[] Cards = new string[51]; public void SkapaKort() { System.Console.WriteLine("Ehhhh"); } } } i want to call the funktion from this code visma.cs into the form1 …

Member Avatar for Dendei
0
98
Member Avatar for jeets1892

Hello, Please take a look at the below code - #include<iostream> #include<ctime> // for the time() function #include<cstdlib> // for the srand() and rand() functions using namespace std; int compInput; int userInput; int die1 = 0; int die2 = 0; int Dice () { // set the seed srand(time(0)); // …

Member Avatar for jeets1892
0
2K
Member Avatar for rahul.ch

import java.util.*; class SampleA { } class SampleB extends SampleA{ } class SampleC extends SampleA{ } class VectorDemo { public static void main(String r[]) { Vector<SampleA> v = new Vector<SampleA>(); v.add(new SampleB()); v.add(new SampleC()); SampleC rect = v.get(2); } } The output says "Incompatible types. Found SampleA, required SampleC. SampleC …

Member Avatar for rahul.ch
0
225
Member Avatar for daino

My initial thoughts on the default constructor are that it was called automatically. From what I can see, it seems that this is so but a constructor called automatically doesn't initialize int or char variables for exampe, to Zero as I originally thought. It appears that they initialize the variable …

Member Avatar for vijayan121
0
297
Member Avatar for DeHF

I need a little bit of help here. I'm new to C++ Classes. There are some errors which I do not know how to troubleshoot. The error of "Declaration terminated incorrectly" for line 6 and 7. Multiple errors of "Type name expected". Why is that? Multiple errors of "Declaration missing …

Member Avatar for WaltP
0
312
Member Avatar for klin1344

Hi. I am a very beginner at Java. I am taking an online course on Java and I'm stuck on an assignment. Anyone who is good with Java, can you please take a look at my code? This assignment was due yesterday but I couldn't finish it. It is very …

Member Avatar for JamesCherrill
0
709
Member Avatar for Pyler

Do you need to implement a class in order for an object to access the class's functions/methods? When should you implement a class? When shouldn't you?

Member Avatar for rubberman
0
339
Member Avatar for Pyler

Could some one point out what's wrong with the classes of this program? #include <iostream> using namespace std; class box { private: int height; int length; int width; public: box();//constructor int surface_area(); int volume(); void set_dim(int ,int, int); }; //implementation box::box(){ int height; int width; int length;} box::int surface_area(){ int …

Member Avatar for WaltP
0
2K
Member Avatar for joshmac

Ok, so I finally was able to convert my framework to the PSR-0 standards, but now I am getting errors in the sample application that I have not been getting before. I am not sure why, so I need a fresh pair of eyes. Any help is greatly appreciated. The …

Member Avatar for joshmac
0
213
Member Avatar for sblass92

Lets say I have a class A and I also have classes B and C that inherit from class A class A { virtual void foo()=0; //stuff } class B : class A { void foo(); //more specific stuff } class C : class A { void foo(); //more specific …

Member Avatar for sblass92
0
346
Member Avatar for Pyler

I wanted to write a simple program that uses classes but I've been running into errors. Anyone have a clue as to what is wrong with my code because I can't seem to figure it out. #include <iostream> #include <iomanip> #include <cmath> using namespace std; class cone{ private: double radius; …

Member Avatar for Rashakil Fol
0
248
Member Avatar for flynismo

As the title suggests, I created a base class named **member** which I want to use to get some basic information, but for some reason, I cannot seem to access those methods/values from the child class named **user_send_message** Here is the complete code that I have made so far -- …

Member Avatar for mschroeder
0
380
Member Avatar for tandex

some people say that multiple inheritance in java is not needed because we have interfaces or that using singular inheritance can bring the same results as using a multiple inheritance. But that is not the case. Lets take a look at the example I call “The Workbench Example” say we …

Member Avatar for stultuske
0
409
Member Avatar for jameswj83

I am having trouble with this assignment, especially the input file and how to get the data into an array: You will design a set of classes for storing student information, along with a main program that will read student information from a file, store the data, compute final grades, …

0
257
Member Avatar for grh1107

currently I'm rewriting old euler solutions into classes so i can store them in a library. I wrote a program that digitizes a number so it can check to see if it a pallindrome, The base class digitize dynamically allocates memory for the size of a number and stores each …

Member Avatar for mike_2000_17
0
252
Member Avatar for mano7859

Hi, I got a problem with class. I've created 3 classes: * identifiantsClass.php * connectInfosClass.php * sqlClass.php In my third class, i always have the message: "error to connect" even if my database's name is good. Please help me... * identifiantsClass.php class Identifiants{ protected $serveur=null; protected $host=null; protected $mdp=null; protected …

Member Avatar for veedeoo
0
134
Member Avatar for kace91

Hello to everyone! This is my first post here, I hope you can help me. I'm making a class work in python and I'm a little lost: I have to use classes to represent monomials and polynomials, and the classes should contain methods to add, substract, multiply and divide them. …

Member Avatar for TrustyTony
0
2K
Member Avatar for TrustyTony

I would like to take string argument for class BalancedTrinary intializer, but the string type of argument is processed before it enters the init function. I guess I must override any class method which deals with those for int/long? def val(number_sequence, base): """ produce integer value of number_sequence as base …

Member Avatar for Gribouillis
0
276
Member Avatar for niceyout

hello i am creating a tictictoe game , however i cannot get the program to check if the player has won or not . and produce a you have won message #include<iostream> #include"110ct.h" using namespace std; class TICTACTOE { CursorController*crs; ColourController*cl; int xplayer ; int oplayer; colour Cs; public: void …

Member Avatar for niceyout
0
167
Member Avatar for naiiimah

I am trying to get this class put together but I've always had trouble figuring out constructors. I don't know what to set the data fields in Customer(int customerID, int checkoutTime, int arrivalTime){} // DO NOT ADD NEW METHODS OR DATA FIELDS! class Customer { private int customerID; private int …

Member Avatar for NormR1
0
199
Member Avatar for mehdimughal

This code is supposed to respond on (w,s,a,d and q) key press..... On "w" the character ( actually the $ sign ) should move up similarly s =down , a is for left and d to move right.......... and 'q' is to quit!! Sometimes on a very few (beginning key …

0
97
Member Avatar for justinfritz

I am having trouble with this part of my program assignment. I have created and compiled the three separate implementation files that design the three classes, they each have a default constructor, overloaded constructor, and a display function. //************************************************************************************************************ "When your program is working correctly, define an array of pointers …

Member Avatar for Saith
0
313
Member Avatar for cwpent

I'm doing a lesson that is supposed to demonstrate inheritance using the song Old MacDonald; there's an animal interface, a farm class that implements each animal object.. you get the idea. I've got two problems. First, The animal has a type and a sound, for example, a chick is [code] …

Member Avatar for joankim
0
1K
Member Avatar for corvenzo

Hi, I'm a pretty new Java student and I was just confused on a few basic concepts. What exactly is the difference between public and private classes and in which case would you use each one? also, what is a constructor, mutator, or accessor? Thank you.

Member Avatar for ash.28.88
0
459
Member Avatar for enkitosh

Hi. I'm making a shooting game and since my code was getting a bit messy and big I decided to divide it into couple of classes and files. I'm confused of how to correctly split these files and classes up though. As I imagine it without really knowing if that …

Member Avatar for Serapth
0
361
Member Avatar for zios007

Yes, I know that this is homework. But I need help. This is code the teacher gave us few days ago. This is a header file. And I needed to do the following: My problem is that I didn't know how to use my vecetor in my .cpp file. How …

Member Avatar for sergent
0
140
Member Avatar for lastbencher

Program: #include <iostream> using namespace std; class Rectangle { float len; float bre; public: Rectangle() {cout << "Rectangle constructed!" << endl; len=0; bre=0;} ~Rectangle() {cout << "Rectangle destructed!" << endl;} void setL(float L) {len=L;} void setB(float B) {bre=B;} friend float area(Rectangle rect); }; float area(Rectangle rect) { return rect.len*rect.bre; } …

Member Avatar for JasonHippy
0
168

The End.