Greetings, I'm working on a class project for fractions and I'm stuck and cannot figure out where to go from here. We have a mandatory driver file we aren't supposed to change. See below for example output and the output I am actually getting. **Sample Output** Enter numerator; then denominator. 5 8 5/8 Enter numerator; then denominator. 4 10 4/10 Sum: 82/80 1.025 Product: 20/80 0.25 Enter numerator; then denominator. 6 0 infinity Driver file import java.util.Scanner; public class NathanialProg7 { public static void main(String[] args) { Scanner stdIn = new Scanner(System.in); Fraction c, d, x; // Fraction objects System.out.println("Enter … +0 Here is my code: ` #include #include #include using namespace std; class Register { //Private members private: //Creating an array for all the Prices static double Price[]; //Declaring RegNUM and RecNUM int RegNUM, RecNUM; //Print out Item name in a loop static string items[]; //Creates a Receipt Structure struct Receipt { //Takes in the number of orders and stores items bought int Orders[5]; double Total = 0; }; //Creating a pointer (RecPTR) Receipt *RecPTR; //Public members public: //Register Constructor Register(int,int); //Member functions void getOrder(int); void RecRETURN(); //Operators Register operator+(const Register &right); Register operator=(const Register &right); }; //Setting … +0 The tools Hal’s sells are: Hammers: $10.99 Wrenches:$10.99 Levels: $19.99 Tape Measures:$4.99 Screwdrivers: \$8.99 In order to make things easier in the long run you have decided to make a c++ program that takes in all the orders for each register and tallies them at the end of the day. Write a c++ program that does the following: Create a Register class that can store all of the receipts for the day and the totals for that register. This class could have the following member functions: Contructor(int) – Creates a number of receipts based on an integer that … +0 Kind of stuck here. I'm porting over a section of code from Java to C#, and I'm having an issue with method permissions constructors. Early in my code, i have this class.. public class TCard { int suit; int rank; } and later i've got this method, which throws a bunch of errors. Identifiers highlighted with the double asterixes throw the "is innaccessible due to its protection level" error. I've tried rebuilding my solution, and this hasn't worked. public void loadDeck(TCard[] deck) { int count; for (count = 1; count <= 52; count++) { deck[count] = new TCard(); deck[count].**suit** = … +0 I had a programme to write for college in Java. I have missed the class so I won't be getting marked on it but wanted to get it done as I have an exam next we. I am really stuck. I have to create a costInsurance () method taking in the surcharges for 3 conditions yearBuilt, numberOfRooms and hasASpa. I gave a shot at the ageSurcharge but have no idea if this is right or not? public class Hotel{ private String name; private String address; private int yearBuilt; private int numberOfRooms; private boolean hasASpa; public Hotel(String nameIn, String addressIn, int … +0 Hello, is this how a constructor is created and initialized. I am getting an error; VB does not like the "New" what I am trying to do is to create a constructor with one argument and initialize its attribute. Public Sub New(ByVal newProdNumber As Long) intProdNumber = newProdNumber End Sub thanks +0 Hey there, I am getting used to Java, but here is something that is stumping me: // Fig. 3.10: GradeBook.java // GradeBook class with a constructor to initialize the course name. public class GradeBook { private String courseName; // course name for this GradeBook // constructor initializes courseName with String argument public GradeBook( String name ) // constructor name is class name { courseName = name; // initializes courseName } // end constructor // method to set the course name public void setCourseName( String name ) { courseName = name; // store the course name } // end method setCourseName … +0 We cannot use constructors if we want that whenever a pointer is declared, it should be NULL. Am I right Sir? if I declare student *head, *tail, where student is a class, can I make my pointers automatically make NULL using default constructor? +0 I'm newbie in C++ programming and I want to declare a constructor from following code in my main however I'm completely confused about it. Here is the code: #include using namespace std; template class HashTable { public: explicit HashTable( const HashedObj & notFound, int size = 101 ); HashTable( const HashTable & rhs ) : ITEM_NOT_FOUND( rhs.ITEM_NOT_FOUND ), array( rhs.array ), currentSize( rhs.currentSize ) { } const HashedObj & find( const HashedObj & x ) const; void makeEmpty( ); void insert( const HashedObj & x ); void remove( const HashedObj & x ); const HashTable & operator=( … +0 I have to write a program that accepts data for a class and then ouputs it in the main. so far i have this. #include #include #include using namespace std; ifstream infile; class animal { string species; string family; string phylum; string desc; static int count; public: bool readIN(const string fname); void printInfo() const; void setAnimal (string s, string f, string p, string d); static int getCount(); animal(string s, string f, string p, string d); animal(ifstream& file, const string fname); }; int animal::count=4; bool readIN(const string& fname) { infile.open("cat.txt"); return infile; } void animal::setAnimal (string species, string family, string phylum, … +0 hi all, In the book "Programming Languages-Pragmatics" second edition by Michael l. Scott and Morgan Kaufmann, there is a sentence while explaining about copy constructor: "In recognition of this intent, a single-argument constructor in C++ is called a copy constructor." This is about the constructor of the form foo::foo(const foo& object); I could understand about that constructor but couldn't understand the statement I have quoted above...I think we cannot state that every single-argument constructor is a copy constructor....If I'm wrong or I seems to be misunderstood the sentence...please help me.... Copy constructor: foo::foo(const foo& object); Normal single argument constructor: foo:foo(int … +0 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 unfinished, but I'm not sure how to continue because I'm still not familiar with the concept of object oriented programming (getters, setters, constructors, etc). Could anyone please explain more object oriented programming to me? Also what do getters and setters do? And can you give me an example of using … +0 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 #include #include using namespace std; class cone{ private: double radius; double height; public: cone(); void setvolume();// double conevol(); }; //implementation void cone(){ double radius; double height; } void setvolume(double r,double h){ double radius=r; double height=h; } double conevol(double r,double h){ double vol=(1/3.0)*(3.14159265)*r*r*h; return vol; } int main(){ cone A; cout<<"The current volume of the cone is: "< class TestA { public: TestA(){} TestA(const TestA &Temp) { printf("TestA called!\n"); } }; class TestB : public TestA { public: TestB(){} TestB(const TestA &Temp) { printf("TestB called!\n"); } }; int main (const int ArgC, const char *ArgV[]) { TestB Test; TestB Test2(Test); //Calls TestA's constructor TestA(const TestA &Temp), instead of TestB's … +0 Ok So Im writing a app which would pick the 'cheapest' plan for a consumer. While writing this I came across something puzzling to me. Why is it starting after the default constructor, the first CellPlan has three arguments passed too it and then the next one two and then one, why can the number be flipped around and be 1,2,3 or: 2,3,1 arguments (after the default constructor)? [CODE] //default constructor public CellPlan() { } public CellPlan(string name, int zip, int minutes) { customerName = name; zipCode = zip; numberOfMinutes = minutes; } // end of CellPlan constructor public CellPlan(string … +0 Hello, I have a class Pdisk [CODE] class Pdisk { public : Pdisk(string diskname, int numberofblocks, int blocksize); private : string diskname; int numberofblocks; int blocksize; }; [/CODE] Now I want to make a class filesys which can access an object of class Pdisk. I am not sure how to pass this object. filesys.h: [CODE] class fileSys{ public: Filesys(Pdisk& disk); private: Pdisk disk; }; [/CODE] filesys.cpp file: [CODE] Filesys::Filesys(Pdisk& disk){//...} [/CODE] In my driver program I want to call [CODE] Pdisk disk("disk",64,128); fileSys fsys(disk); [/CODE] I am using Visual C++ and get the error that there is no default constructor. … +0 What's wrong with my code? Why can't I output the "hahahaha" string from public constructor1?? help me please. [CODE]using System; namespace hahahahahahahahaha { class Program { public static void Main(string[] args) { constructor1 obj = new constructor1(); } } public class constructor1 { public constructor1(); { Console.WriteLine("hahahaha"); } } }[/CODE] +0 So i haven't figured out what the point of constructors are i am just learning C++ and am seriously having trouble with it, i do not get why...well i kind of get default constructors because it initializes the variables but what about a constructor with arguments and the member function +0 Here's the scenario: I am coding a program that will display data from a database in a variety of fields. Some of the fields need to be read-only. Should have been simple just to set all those controls to read-only, except some of them are checkboxes, radio buttons and date pickers, which do not support a read-only setting. I could mark them disabled, but that changes the color on the controls, and overriding the colors is more complicated than I want to do. So the solution that I'm trying to implement is to cause an empty label (or other control) … +0 I have an assignment where I have been asked to ask the user for input. What I am trying to figure out is if there is anyway to call and use methods of another class whose constructor requires parameters without passing them from the main class that will be calling said methods. i.e. [CODE]public abstract class Employee { private String firstName; private String lastName; private String socialSecurityNumber; // three-argument constructor public Employee( String first, String last, String ssn ) { firstName = first; lastName = last; socialSecurityNumber = ssn; } // end three-argument Employee constructor // set first name public … +0 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 wish to, including letters, if this happens it will send the program into an infinite loop, so I made the code to read the input as an array, but now it won't go into the function, and the program will simply stop when i compile, anyone know how I can … +0 copy constructors ?? what are they ? +0 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 no: " + RollNo + "" + " Name: " + name); } public Student (){ RollNo= 99999; name = "Name is not set"; stdcount++; } } class Records { public static void main (String args[]) { Student std1 = new Student(); Student std2 = new Student(); std1.RollNo = 2000; … +0 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 { get { return _filename; } set { _filename = value; } } } }[/CODE] +0

The End.