|
|
|
Hi guys. I need suggestions on C# projects that are not too hard but not too simple since it might be not pleasant for our professor. My group mates and I need to do an object oriented program/system and we cannot think of anything as of now since we are not really good at programming. Anyway, your suggestions are appreciated. Thanks!
|
|
|
|
|
Is this for a computer science course of some description? If I were looking to do something like this, I'd pick something that interests me and look at writing a project based on that. The reason for this is simple - if it's something I'm interested in, then I already have some knowledge about the topic. That makes it easier for me to design the application.
|
|
|
|
|
Not exactly, it's an information technology course. I really cannot think of anything as of now and we need to pass a proposal on Wednesday. I was thinking of a payroll system but it's too hard for us without any guide or help at all
|
|
|
|
|
Remember that you are the team who have to write the code - we aren't going to do it for you, so anything you write has to be something you know and understand. What are your interests? Are you mad about morris dancing? Do you jitter with joy at crochet work? What do you do for fun?
|
|
|
|
|
I know I was thinking of tracking system/program like what delivery companies have or an information system that lists employees and tracks their attendance. Are they applicable to be object oriented? That's my problem as of now since the project we need to pass has to be object-oriented coded.
|
|
|
|
|
Address book, Password keeper, Home inventory, Money tracker ...
Use the best guess
|
|
|
|
|
So I was thinking of creating an information system.
Modules would be:
-Employee List
-Attendance Tracking (how many absents or leaves)
-Time in and out
-Employee Information
- ???
I really cannot think properly as of now, forgive me. Is it good or bad?
|
|
|
|
|
jeedolas wrote: Is it good or bad? Sounds like a good idea to me, but it all depends on what your professor is expecting.
Use the best guess
|
|
|
|
|
This is your first projects. So you don't need to include many modules. What ever you listed is more than enough. You need to concentrate more on the functionality, the way project is structured. Try and use latest technologies. For example - Choose appropriate framework(like MVC, if it is web based), Use ORM like Entity framework.
|
|
|
|
|
Does it have to be boring?
|
|
|
|
|
Ooh, that's a great idea. A database that links drill bits to screw sizes and wall plugs, taking into account whether or not you need to use masonry bits.
|
|
|
|
|
The OP did say it was for school.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
jeedolas wrote: since it might be not pleasant for our professor.
..and the prof has no bloody idea of what might be appropriate for someone with your level of expertise? Does the prof need a hand in Googling?
There's a "starter kit" for timesheets available from Microsoft.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Work on sth which have database (not advanced).
it can be find on Customers lists/info, Advanced Phone Address Book, Basic windows utilities or sth like that.
also in this Projects if you add a simple compute you can be BEST!
also i prefer using WPF for good style if you can.
-Amir Mohammad Nasrollahi
/* LIFE RUNS ON CODE */
|
|
|
|
|
Quote: since we are not really good at programming
I like your honesty.
Thanks
-Amit Gajjar
|
|
|
|
|
Implement a game.
Most games are well defined, which will make it easier than an open-ended project like an inventory system. They're also more fun.
Games also range from simple card games to Monopoly or chess. Pick one at an appropriate level.
|
|
|
|
|
Hi all,
Please tell me if this code bellow object oriented or not. If it is not what changes that are needed to become an Object oriented?
Thank you.
Here is the code:
using System;
using System.Collections.Generic;
using System.Collections;
using System.Text;
using System.Threading.Tasks;
using System.Net;
namespace GrillMaster
{
///
/// This class is main class.
///
public class GrillMaster
{
int GrillCapacity;
string MenuNbr;
int k;
int[] BestFit;
List<int> LstData; // Dynamic list to store the item value
Hashtable hTable; // Hashtable to use the store item name, itemValue pairs
///
/// Constructor method
///
/// <param name="Capacity" />
/// <param name="MenuNbr" />
public GrillMaster(int Capacity, string MenuNbr)
{
this.GrillCapacity = Capacity;
this.MenuNbr = MenuNbr;
this.LstData = new List<int>(); // Dynamic list to store the item value
this.BestFit = new int[100];
this.hTable = new Hashtable(); // Hashtable to use the store item name, itemValue pairs
}
///
///
///
/// <param name="NbrItm" />
/// <param name="ItmVal" />
/// <param name="ItmName" />
public void FillList(int NbrItm, int ItmVal, string ItmName)
{
for (int i = 1; i <= NbrItm; i++)
{
LstData.Add(ItmVal); // fill in the list data with the item value
}
if (!(hTable.ContainsKey(ItmName)))
{
hTable.Add(ItmName,ItmVal); // if HashTable not contains the current item then add it.
}
}
///
///
///
public void ClearList()
{
this.LstData.Clear();
}
public void NumberOfRoundsBestFit()
{
int m = 0;
bool bOK = true;
k = 0;
LstData.Sort(); //Sort the data
LstData.Reverse(); // Sort the data in descending order
BestFit[k] = GrillCapacity;
foreach (var elm in LstData)
{
bOK = true;
for (int m1 = 0; m1 <= m; m1++)
{
if (elm <= BestFit[m1])
{
BestFit[m1] -= elm;
bOK = false; //if find correct empty Grill set variable to false
break;
}
}
if (bOK)
{
k++; //increase the rounds
BestFit[k] = GrillCapacity; // set the initial capacity of the grill
BestFit[k] -= elm; //Decrease the capacity of the grill
}
m = k;
}
}
///
///
///
public void NumberOfRounds()
{
int Capacity = GrillCapacity; // save the capacity of Grill
k = 0;
LstData.Sort(); //Sort the data
LstData.Reverse(); // Sort the data in descending order
foreach (var elm in LstData)
{
if (elm <= Capacity && elm <= GrillCapacity)
Capacity -= elm; //Decrease the capacity of the grill
else
{
k++; //increase the rounds
Capacity = GrillCapacity; // set the initial capacity of the grill
Capacity -= elm; //Decrease the capacity of the grill
}
}
foreach (DictionaryEntry entry in hTable)
{
Console.WriteLine("{0}, {1} ", entry.Key, entry.Value); //display on the console key and value of the HashTable
}
}
///
///
///
public void PrintData()
{
Console.WriteLine("Menu "+ this.MenuNbr + ": "+ (k + 1) + " rounds.");
}
}
///
///
///
class Program
{
static void Main(string[] args)
{
int GrilDim = 600; //Der Grill misst 20cm x 30cm
string MenuName = "";
int[] Items = new int[] { 100, 200, 300, 400, 200, 100 };
string[] ItemsName = new string[] { "Fleisch1", "Fleisch2", "Fleisch3", "Fleisch4", "Fleisch2", "Fleisch1" };
/* Uri serviceUri = new Uri("http://grillassessment.cloudapp.net/GrillMenuService.svc");
var serviceCreds = new NetworkCredential("svelkov@gmail.com", "Ycsu4"); var cache = new CredentialCache(); cache.Add(serviceUri, "Basic", serviceCreds);
var service = new GrillMenu.GrillMenuContext(serviceUri)
{ Credentials = cache };
foreach (var grillMenu in service.GrillMenus.Expand(g => g.GrillMenuItemQuantity))
{
Console.WriteLine("Menu: {0}", grillMenu.Name);
MenuName = grillMenu.Name;
GrillMaster TestGrill = new GrillMaster(GrilDim, MenuName);
foreach (var grillMenuItemQuantity in grillMenu.GrillMenuItemQuantity)
{ service.LoadProperty(grillMenuItemQuantity, "GrillMenuItem");
TestGrill.FillList(1, grillMenuItemQuantity.Quantity, grillMenuItemQuantity.GrillMenuItem.Name);
Console.WriteLine("{0} x {1}", grillMenuItemQuantity.Quantity, grillMenuItemQuantity.GrillMenuItem.Name);
}
*/
GrillMaster TestGrill = new GrillMaster(GrilDim, MenuName);
for(int i =0; i < Items.Length; i++)
{
TestGrill.FillList(1, Items[i],ItemsName[i]);
}
TestGrill.NumberOfRounds();
TestGrill.PrintData();
TestGrill.ClearList(); // Clear the list , and prepare for the next menu!!!
Console.WriteLine();
//}
Console.ReadLine();
}
}
}
modified 29-Jul-13 7:32am.
|
|
|
|
|
No one really agrees just what "object oriented" means, other than that objects are involved.
Anyway, please don't declare things like i or k as fields. The general guideline "variables should be declared in the tightest possible scope" is, of course, just a guideline, however it exists for good reasons. Code such as this, with i 's and k 's all over the place (and even a definition of i that hides the outer one) is harder to reason about. I had to read all of the code to find out that you really weren't sneakily using them somewhere before resetting them. And there was really no reason not to follow the guideline here, as far as I can tell.
|
|
|
|
|
+5 just for reading through that.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
stmk69 wrote: Please tell me if this code bellow object oriented or not. If it is not what changes that are needed to become an Object oriented? That would give you an example, but it's not said that the example would help in determining whether the next class you encounter is OO or not. It's more efficient to research the difference between non-OO and OO-code.
Non OO-code in C# (procedural code translated to C#)
static class X
{
public static void Method1(string arg1, int arg2, bool arg3, bool arg4)
{
}
public static void Method2(int arg2, bool arg4)
{
}
public static bool AllBoolArgsTrue(bool arg3, bool arg4)
{
return ((true == arg3) && (true == arg4));
}
} Take note that it's a list of procedures that you can call, along with some parameters, without instantiating the object. The proper OO-version of this code would look similar to the code below;
class X
{
string arg1;
int arg2;
bool arg3;
bool arg4;
public X(string arg1, int arg2, bool arg3, bool arg4)
{
}
public void Method1()
{
}
public void Method2()
{
}
public bool AllBoolArgsTrue()
{
return ((true == this.arg3) && (true == this.arg4));
}
} The example might suck, but it shows clearly why we prefer OO-code; it's more readable, and hence, easier to maintain. Instead of passing a variable to each method of the class, we pass it to the object. Stuff that belongs together is grouped together - and each object becomes an easy testable black-box. No more spaghetti-code!
This would be the essence; good OO-code has more features, like inheritance - but one does not "always" require a base-class, it's not a mandatory construction. On the contrary, if it doesn't add anything (beyond complexity) then it should be omitted.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
I am loading an assembly as follows:
Assembly assembly = assembly.LoadFile("file.dll");
I am then looping through the types within in and when a particular type is found I want to retrieve a property from it as follows:
Type[] types = null;
types = assembly.GetTypes();
foreach (Type type in types)
{
if(type.Name.ToString().Equals("TYPE"))
{
PropertyInfo proprty = type.GetProperty("PROPERTY", BindingFlags.GetProperty | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
}
}
The property is a HashTable but no matter what method I try to obtain the property value i.e GetValue etc I am unable to retrieve it.
I am probably doing something stupid. Can someone give me guidance as to the syntax required to obtain the property and cast it into an actual HashTable value that I can operate on?
|
|
|
|
|
First of all, you can't use the type until you instantiate it. Merely retrieving an assembly doesn't have any real effect. Secondly, why not use GetType instead of looping through the types? The following code should demonstrate some of what you need to do.
Assembly assembly = Assembly.LoadFile(@"pathtofile\TestFile.dll");
var type = assembly.GetType("TestFile.MyType");
if (type == null) return;
object instance = Activator.CreateInstance(type);
PropertyInfo propertyInfo = type.GetProperty("MyHashTable",
BindingFlags.GetProperty | BindingFlags.NonPublic |
BindingFlags.Public | BindingFlags.Instance);
if (propertyInfo != null)
{
object myHashTable = propertyInfo.GetValue(instance, null);
Hashtable ht = (Hashtable) myHashTable;
ht.Add("Hello", "Hello");
} Obviously, you'll want to put a lot more checking in place, but this should give you the basic idea.
|
|
|
|
|
Thanks for the info Pete.
That unfortunately is the trouble in Paradise because I am trying to use the properties of this assembly without referencing anything explicitly and the assembly in question has an entry point that is quite complex as it uses other referenced assemblies that connect to a database. plus there are lots of associated namespaces and associated functionality. a Framework - if you like...
Anyway - although it is a structured environment I want to do this dynamically. As I said without referencing. this is because this is a standalone application and I want to scan, not load the whole external app and its associated framework... Also if I do explicitly reference the required assemblies it will become a pain to manage further versions of my application as the external application it is supposed to reflect is a strongly typed application that is not backwards compatible i.e version 2 is not compatible with version 1 etc so each release will need to be recompiled...
I know it is possibly but it will just take me too much time to make it so at this point!
I am going to investigate the hashtable fields for key names... hopefully that will do it!!
|
|
|
|