|
thank you for your response
keep up your suggestion they will make the things easy for me
is there any reading material that you suggest specifically about firewall and networking in C#
|
|
|
|
|
heres a good book http://tinyurl.com/5zxuyb
good luck!
-Steven
C# Programmer
|
|
|
|
|
I. Overview
1. Create a program that will accept the necessary inputs and generate the proper outputs based on the processing instructions.
2. The program should meet all the requirements.
II. Inputs
1. Employee’s ID Number – an 8 digit integer
1st four digits signifies the year the employee started.
5th digit signifies employment type. 0 for regular, 1 for
contract. Other values are invalid.
Last 3 digits are irrelevant for this program.
2. Salary Grade – a real number
3. Days worked for the month – an integer with valid values of 1 to 31 only.
4. wBonus – a character to signify whether the employee will receive a bonus or not
III. Processing
1. Prompt for all necessary inputs. Check every input for validity.
2. Compute for the employee’s salary for the month.
Basic Salary = Salary grade * Days Worked
For employees with bonus
For regular employees who started before 1990
Bonus = Basic Salary * .4
For regular employees who started before 2000
Bonus = Basic Salary * .3
For regular employees who started before 2006
Bonus = Basic Salary * .2
For regular employees who started after 2005 and contract employees
Bonus = Basic Salary * .1
Salary for the Month = Basic Salary + Bonus
3. Accumulate Total Basic Salary and Total Bonus.
4. Display Employee’s Salary for the Month(output #1)
5. Prompt if the user wants to process another employee. If yes, go back to #1.
6. Display Total Basic Salary and Total Bonus(output #2)
IV. Outputs (use 2 decimal places for real numbers)
1. ID Number and Salary for the Month. Example:
ID Number: 19970123 Salary: P1500.50
2. Total Basic Salary and Total Bonus. Example:
Tot Basic Salary: P180,000.90 Tot Bonus: P20,000.55
V. Requirements
1. Use the printf function for all outputs including prompts.
2. Use the scanf function for accepting/reading all inputs.
3. Use defined constants for the constants used in the bonus computation.
4. Declare/define functions for each routine/subroutine in the program.
5. Use error checking. If the user inputs an invalid value, inform the user and prompt for a new value.
6. Users should be able to use the program without special instructions or training.
bleh
|
|
|
|
|
So.. what's your question?
Regards,
--Perspx
Don't trust a computer you can't throw out a window
-- Steve Wozniak
|
|
|
|
|
It soesn't look too difficult.
It's already broken down into sections so deal with each one individually.
I'd leave the validation until last - get it working first.
Enjoy coding, and post back if you have any specific problems relating to your code when you've written some.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Expect everything to be hard and then enjoy the things that come easy. (code-frog)
|
|
|
|
|
What is it that you need help with?
Don't you understand the instructions? They seem very clear to me.
Judging from the contents of the instructions, you have posted in the wrong forum. This forum is for C# programming, not C/C++ programming.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
So what code have you written so far?
Kevin
|
|
|
|
|
I suggest changing majors now.
Blog link to be reinstated at a later date.
|
|
|
|
|
i hope you are not asking anyone to type the all program for you!?
whats your question?
nelsonpaixao@yahoo.com.br
trying to help & get help
|
|
|
|
|
This is why I feel secure in my job. Schools full of students who are obviously too dumb to do IT, and too dumb to know it.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Hello all,
I am currently developing a application on windows mobile that can receive video image from webcam via a desktop. Here is my code:
namespace ABC
{
public partial class Form1 : Form
{
// private System.Net.IPHostEntry ips = System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName());
//---port nos and server IP address---
const Int32 PORTNO = 500;
string server_IP = "10.0.1.200";
//---size of the video image---
const int SIZEOFIMAGE = 341504;
//---use for connecting to the server---
TcpClient client;
//--used for sending and receiving data---
byte[] data;
//---used for receiving images from the server---
System.Threading.Thread t;
private void ReceiveImageLoop()
{
//---keep on receiving image until an error occurs---
while (ReceiveImage())
{
MessageBox.Show("in receive image");
}
//---display error message---
MessageBox.Show("Server has stopped responding. Please try restarting the video.");
}
//---Sends a message to the server---
private void SendMessage(string message)
{
//---adds a carriage return char---
message += "\n";
try
{
//---send the text
System.Net.Sockets.NetworkStream ns = null;
lock (client.GetStream())
{
ns = client.GetStream();
byte[] bytesToSend = System.Text.Encoding.ASCII.GetBytes(message);
//---sends the text---
ns.Write(bytesToSend, 0, bytesToSend.Length);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
//---receive video image from server---
public bool ReceiveImage()
{
MemoryStream s = new MemoryStream();
NetworkStream nws = client.GetStream();
int counter = 0;
int totalBytes = 0;
do
{
MessageBox.Show("trying to read data...");
//---read the incoming data---
int bytesRead = nws.Read(data, 0, client.ReceiveBufferSize); totalBytes += bytesRead;
//---write the byte() array into the memory stream---
s.Write(data, 0, bytesRead);
counter += 1;
//Loop Until totalBytes >= SIZEOFIMAGE
} while ( ! (totalBytes >= SIZEOFIMAGE));
//---display the image in the PictureBox control---
PictureBox1.Image = new Bitmap(s);
//---ask the server to send the next image---
SendMessage("Send");
return true;
}
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
if (((Button)sender).Text == "Start")
{
//---connect to the server---
client = new TcpClient();
client.Connect(server_IP, PORTNO);
data = new byte [client.ReceiveBufferSize];
//---send message---
SendMessage("Send");
//---begin reading data asynchronously from the server---
t = new System.Threading.Thread(ReceiveImageLoop);
t.Start();
}
else
{
//---send message---
SendMessage("Stop");
t.Abort();
}
}
}
}
-------------
I keep on getting error message saying IOException for the code of lines highlighted in Bold. I have no idea why I am getting this as for my Windows version of the code, it is working smoothly.
Here are the details of the exception:
System.IO.IOException was unhandled
Message="An error message cannot be displayed because an optional resource assembly containing it cannot be found"
StackTrace:
at System.Net.Sockets.NetworkStream.Read()
at FYP.Form1.ReceiveImage()
at FYP.Form1.ReceiveImageLoop()
.
Help/suggetions from anyone will be highly apprecaited ! thanks !
|
|
|
|
|
add
data = new byte[client.ReceiveBufferSize]; before bold line
hope it helps
dhaim
programming is a hobby that make some money as side effect
|
|
|
|
|
Hi Mbah,
I am still getting an error after inserting your line.
Any more suggestions ?
Thanks !
|
|
|
|
|
do
{
if (nws.DataAvailable){
int bytesRead = nws.Read(data, 0, client.ReceiveBufferSize);
totalBytes += bytesRead;
s.Write(data, 0, bytesRead);
counter += 1;
}
} while ( ! (totalBytes >= SIZEOFIMAGE));
hope it helps
dhaim
programming is a hobby that make some money as side effect
|
|
|
|
|
Hi Mbah,
I finally got it working. However, I notice that I am reading nothing at all. When I call client.ReadBufferSize, it returned 0 in windows mobile but 8167 in windows (which 8167 is the datasize I set for server sending information to this program). Any suggestions ?
|
|
|
|
|
Not a question, but something I learnt today that I'd like to share .
If I declare and initialise as follows...
<br />
string[] a,b,c;<br />
a = b = c = new string[size];<br />
a, b, and c all share the same memory location (i.e if you alter b - c and a are affected the same).
Something I should have spotted, but is all so easy to overlook with these fancy new languages.
.
Mark Brock
"We're definitely not going to make a G or a PG version of this. It's not PillowfightCraft." -- Chris Metzen
Click here to view my blog
|
|
|
|
|
Exactly, because arrays in C# are reference types.
|
|
|
|
|
Someone might be mislead to believe that...
string[] a, b, c;<br />
a = b = c = new string[size];
would behave the same as...
int a, b, c;<br />
a = b = c = 10;
...which (as you discovered) it doesn't.
MarkBrock wrote: but is all so easy to overlook with these fancy new languages
...easy to overlook because it is poor style and easily misleading. To clearly show your intentions, it would have been better coded as either:
string[] a = new string[size];
string[] b = a;
string[] c = a; or
string[] a = new string[size];
string[] b = new string[size];
string[] c = new string[size];
...depending on what your intentions are.
|
|
|
|
|
I am using ApplicationDeployment in my project but i am getting error
The name 'ApplicationDeployment' does not exist in the current.
The name 'HttpUtility' does not exist in the current context.
I am not using namespace ? , if yes then what are the namcesapace for both of them.
|
|
|
|
|
What does the manual say for namespace
|
|
|
|
|
I seem to be struggling a bit creating a custom control. Just a plain ordinary custom control with some extra properties is no problem but when it gets a little more complex I'm stuck.
I am trying to make a fancy panel. All it is is a control with a panel in the centre while the space around the panel is used for drawing a border in.
So far so good. I can create a control with a panel in the middle and space around the sides for drawing a border but when the control is added to a form at deign time and I want to add controls into the panel, I have problems. The controls are being added to the control allright but not to the panel on the control. In other words, the new controls become child controls of my custom control exactly like the panel is a child control.
Any help please?
|
|
|
|
|
Add this attribute to your user control
[Designer("System.Windows.Forms.Design.ParentControlDesigner,
System.Design", typeof(System.ComponentModel.Design.IDesigner))]
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Expect everything to be hard and then enjoy the things that come easy. (code-frog)
|
|
|
|
|
hi
i am writting a writer program that use XPBurncomponent.dll
a pice of code that i used is:
XPBurn.XPBurnCD cd = new XPBurn.XPBurnCD();
cd.AddFile(@"c:\pic1.jpg","pic1.jpg");
cd.RecordDisc(false, true);
but sometimes an error is shown :
error: Exception has been thrown by the target of an invocation
can anybody help me please?
M.Alizadeh
|
|
|
|
|
|
Hi all!!
I have a problem about my project. I want to add tag to files or directories and I have a problem about program start up.
in these code I can get full path but there is some problem about directories name.
For example:
C:\Documents and Settings\*****\Desktop\ListViewExample for this there is no problem
but
C:\Documents and Settings\*****\Desktop\List View Example but if a directory or file name have a space there is a problem occures like that :
C:\Documents and Settings\*****\Desktop\List\View\Example
I could not find a solution with for each too. How can I solve this problem? Thank you very much.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
namespace ARC
{
static class Program
{
[STAThread]
static void Main(string[] args)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
if (args != null)
{
string FilePth = "";
for (int i = 0; i < args.Length; i++)
{
FilePth += args[i]+@"\\";
}
MessageBox.Show(FilePth);
if (FilePth != "")
{
parameter.FilePath = FilePth;
Application.Run(new Form1());
}
}
else
{
}
}
}
}
|
|
|
|