|
I am working on a program to display pupil essay homework data.Making the program define class pupil and class homework. Program to display hardcoded data for homework such as 150words, word friend in text etc. User of program to be able to enter keywords to be checked for and be able to request to see such essay homework data for a pupil.
Any clues how to get on such a task ?
public class Pupil
{
private string name;
private int id;
private static int numberofPupils = 0;
public pupil(string pupilName);
{
name = pupil Name;
id = ++numberofPupils;
}
public class homework
{
private string homeworktitle
private int numofwords
private string keyword etc
|
|
|
|
|
Asked this question 6 hours ago.
|
|
|
|
|
At least he/she is attempting to write some code now
Dave
|
|
|
|
|
If there's going to be more than one pupil as indicated by your static variable numberofPupils I'd create another class PupilCollection : List<Pupil> and add them to that.
Otherwise, you're underway and post back with any specific code problems
Dave
|
|
|
|
|
It doesn't appear as if you've sufficiently analyzed the problem. Until you do that, you can't possibly design the code.
You have one or more pupils, and each of them have one or more homework assignments (like the one you want us to do for you now). Since you don't know how many of either object you will have, you should use a generic list for each.
If it were me, I'd give the pupil object a numeric ID, a name, an address, and a phone number, as well as a list to hold homework assignments. I'd provide public properties to retrieve these items from the pupil object.
As for the homework object, I'd include a numeric ID, a date it was assigned, a date it was turned in, a date it was supposed to be turned in, a subject (or title), and the other required fields. By the way, how are you going to count the words in an essay? Manually? I'm glad I don't have that job (or the transcriber's job for that matter).
At this point, you can iterate through the pupils list and retrieve either average homework grades for each pupil, or determine if they completed a specific homework assignment.
Welcome to the world of computer programming.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Thank you for the advice.I am on it. I will keep trying.It is quite encouraging to see that I am being motivated to put more and moe effort.
|
|
|
|
|
I'm trying to figure out how to override the value of a propery for a parent class in a child class.
For example, i have
public class Base<br />
<br />
{ public virtual string _Caption="parentresult";}<br />
<br />
public class Child<br />
<br />
{ public override string _Caption="childresult";}
But the "virtual" and "override" keywords raise errors during compilation("modifier not valid for this item). They work if I set them up accessor methods, but I shouldn't have to do that (should I?).
Is it possible to make them consts, also?
|
|
|
|
|
redivider.geo,
I think you can only override methods/properties and not variables. Also, your Child class does not inherit Base so it has nothing to override.
public class Base
{
private string _caption = "parentresult";
public virtual string Caption
{
get { return _caption; }
set { _caption = value; }
}
}
public class Child : Base
{
public override string Caption
{
get { return base.Caption; }
set { base.Caption = value; }
}
}
Regards,
Gareth.
(FKA gareth111)
|
|
|
|
|
Variables can not be virtual. What you are doing is not overriding, it's shadowing. To tell the compiler that you intend to shadow the variable in the parent class, you use the new keyword:
public class Base {
public string _Caption="parentresult";
}
public class Child : Base {
public new string _Caption="childresult";
}
If you want to override something, it has to be a property or a method.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Is it possible to remote control a DirectX application like Warcraft3?
I want to create a simple helper for joining games - for that I would need access to the buttons and write strings into the boxes.
If this is possible anyone good some good keywords for me to find more informations?
|
|
|
|
|
If you are trying to remotely control a computer you could use VNC and then try to adapt an open source VNC to your needs.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
I am a fairly new to .Net application and am assigned a task to create a print functionality from a web application written in C#. Can anybody tell me how to do it?, or direct me a url where I can find information?
|
|
|
|
|
You need to look call window.print(); in a javascript function. For instance <a onclick="window.print();<Print<a>.
|
|
|
|
|
|
Hi Friends,
iam looking c# windows (desktop) application( Not web), browse and upload functionality sourcecode. Please help me - Thanks
|
|
|
|
|
Take a look at the WinForms toolbox in your IDE, i'm sure there's a control that mentions something about Files and Browsing. and a quick google search for file browsing and c# would probably give you tons of examples, mabye even a few articles here. i dont know about everyone here but i've noticed that most of us dont like bieng asked for sourcecode without any evidence that the person asking the question has actually tried to solve the problem, some dont like bieng asked for it even with evidence.
|
|
|
|
|
Hello.
I'm programming a Windows Application which manage data in a MS SQL Server database.
So, I created a DataSet of the database by means of the wizard, and in the "Advanced Options" I checked the followin check box:
Refresh the data table
Adds a Select statement after Insert and Update statements to retrieve identity column values, default values, and others values calculated by the database.
Now, I need to retrieve the identity value of the row I'm inserting.
Which "Select statement" was added in order to get the identity column value after insert a row?
How should I use those statements?
Thank you, in advance.
--
[Adrián Córdoba]
|
|
|
|
|
If i remember correctly it adds whatever select statement it initially uses to the ends of update and insert and delete commands so that the dataSet in memory is always accurate to what is in the database so you can spot errors easily, and you dont have to worry about the dataset saying one thing and the db saying another. You can change the statements, but you have to move the declaration statements out of the InitializeComponent method which is generated for you and put them into the forms constructor or load event. there may be problems with moving them that i havnt found yet..i dont do much with the data once i get it.
|
|
|
|
|
OK.
Please, suppose I just inserted a new row in a datatable with:
myDataSet.myDataTable.Rows.Add(myNewRow)
How can I get the identity column value?
Thank you.
--
[Adrián Córdoba]
|
|
|
|
|
What are you using for your identity column value..is it an auto increment field? I never use auto increment fields, for this reason, i actually have a table called counters that has maybe a dozen or so values that i increment every time i reference them, but i never let the db adjust them on its own, i use a getNextNumber stored procedure that returns the current value and then increments it so its ready for next time. that way i always know what PK i'm dealing with in the code. Or i make the PK derive from something i know so that its never not known or available to me in code or SQL. but anyway, You would have to call the update method on the dataAdapter assoc'd with your dataSet(assuming you are doing it that way) and then go find your new row in the result set it returned..probably the last one, unless you order them differently in your select statement.
|
|
|
|
|
Yes, I used an auto increment identity column.
Thank you very much.
--
[Adrián Córdoba]
|
|
|
|
|
There are several problems with an auto increment column , mostly involves using foreign keys and moving the data around the databse if you ever had to..its always a good idea to control what your keys are and not let something decide for you, then you have to get the new key before you insert so you dont have this problem.. I dont know your data so i cant suggest a good key, but if you're happy with a simple incrementing integer, why not just do table that contains several rows with the id name, its current value, and what to increment it by and use a stored procedure to return the current value then increment it, that way 2 synchrous requests cant duplicat the value...its a little more work but solves a lot of problems now and in the future. onces its set up you can use it all over the place when the data you're trying to store doesnt give you a decent primary or composite key.
|
|
|
|
|
I understood you, but database is already working (in production), so I can't modify it.
Thank you very much.
--
[Adrián Córdoba]
|
|
|
|
|
then the only way i know if is to insert your row then go looking for it in the dataset, if you are using a data adapter. If you are using a stored procedure you could have the SP return the new identity. sorry auto increments make things harder than they should be sometimes.
|
|
|
|
|
Hi every one. I don't know if this is the right section to make this question. So if it isn't sorry
How can I use the click event of the print button on the toolbox of an crystalreportviewer? The problem is that a need to update a field in my database when the report is for the fist time printed.
Thank you all.
|
|
|
|