[Show all top banners]

Unit
Replies to this thread:

More by Unit
What people are reading
Subscribers
:: Subscribe
Back to: Computer/IT Refresh page to view new replies
 Help on c program

[Please view other pages to see the rest of the postings. Total posts: 32]
PAGE: <<  1 2  
[VIEWED 11831 TIMES]
SAVE! for ease of future access.
The postings in this thread span 2 pages, go to PAGE 1.

This page is only showing last 20 replies
Posted on 06-20-06 7:58 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

Is there any one who can help on C programming? This my first program class and i am having really hard time understanding it. would you guys PLEASE help me out?

here is the question.
A company pays its employees as managers (who receive a fised weekly salary), hourly workers (who receive a fixed hourly wage for up to the first 40 hrs they work and time and half for overtime hrs), commision workers(who receive a $250 olus 5.7% of their gross weekly sales), or pieceworkers(who receive a fixed amount of one type of item). write a program to compute the weekely pay for each employee. you do not know the number of employees in advance. Each type of employee has its own pay code: Managers have paycode 1, hourly workers have code 2, commission workers have code 3 and pieceworkers have code 4. Use a "SWITCH" to compute each employee's pay based on tha employee;s paycode. within the "SWITCH", prompt the user(i.e the payroll clerk) to enter the appropriate facts your program needs to calculate each employee's pay based on that employee's paycode. (your program must use loop)
 
The postings in this thread span 2 pages, go to PAGE 1.

This page is only showing last 20 replies
Posted on 06-20-06 10:55 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

When the time comes, I sure will holler at you for the help. Thanks! I wonder why are being so informative about yourself!:S

Like others have said, it is mandatory to write your own codes. That's how your learn.It's the experience talking. Writing programs cannot be learned until you learn and write on your own.
Good Luck!
 
Posted on 06-20-06 10:58 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

flippu,
for u any time (O: ...
u must b joking 4 real right...
smart person lyk u need help .. re bho bho.. joke nagarnush hajur
malai ta actually kehi ni aaudaina (O:
=====================================================
as always
what do i knoe (O: ...
 
Posted on 06-20-06 11:01 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

imi, i m not an IT guy, my major is sth else, i need to do quite a lot programming hence i know a bit abt programming.

as for your question goes, i have not extensively worked in Access alone. however i know a bit of visual basic. you can create a browser based form in VB and then get it connected with the access. have u worked in VB?

Loote
 
Posted on 06-20-06 11:04 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

I know about that loote,
but i don't know VB , i know only fortran and Lisp .Can we do it with fortran or Lisp?
ok!
i am not cs guy so :)
 
Posted on 06-20-06 11:07 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

oh ya can we do in Matlab??:)
 
Posted on 06-20-06 11:08 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

I wouldn't have asked for help if I was good in writing codes. Btw I have a querry for you thapap. You doing intern at the moment? Just a curiosity!

Loote, maxed out again eh? Ani what did I hear! You know a bit about VB. :) Nice, nice!
 
Posted on 06-20-06 11:11 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

i m sure fortran and and matlab does not have browser support feature. and i m quite sure lisp does not offer it too, although i m not 100% sure.
where did u learn lisp? the only one time that i used it is in my AI class. i hated it in the beginning but its strong i only realized later.

go for VB, it won't take long to learn. with online help and MSDN you would be able to get it done easily, i m sure.

Loote
 
Posted on 06-20-06 11:13 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

so Im1
seems 2 be an EE from 1990s writing programs in lisp and fortran.. from MIT (O:

sure Im1 u can do that in MATLAB.. Matlab has C extension to it.. so write a program to access ==>>> access database .. (O:

if u write an JAVA applet then it can be done very easily. u need to access the database. jdbc provides basic connectivity..

PS. I AM ALSO NOT A CS MAJOR (O: .
 
Posted on 06-20-06 11:15 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

filip folop,
sorry about my redundant info on "being nocturnal". :) and dont worry about that "did u hear thing" too. :) i was all kidding. :).

Loote
 
Posted on 06-20-06 11:21 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

Though You are not CS major thapap, you still need to learn a lot about writing codes, don't ya? Circuits and programming go along very well.
 
Posted on 06-20-06 11:25 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

flippu,
u r vry smart kya.. and i am intimidated by ur grace. sanchi bhaneko.

ani 2 answer ur question. presently, EE need to have hands on on programming including databases (O:

and for ans 2 other question.. pls look @ ur email. (O:
 
Posted on 06-20-06 11:29 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

sure Im1 u can do that in MATLAB.. Matlab has C extension to it..


thapap, u r going to kill imi...hehe. creating a browser based form with C? why u need to take that pain when u have application oriented VB to deal with? CT baata AL jaana "via europe" ticket katya jasto kura bho ni ;)

Loote
 
Posted on 06-20-06 11:30 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

oh i need easy way out, i want the Access to do that for me.:)

And i am not EE from 1990s i am from 2000s.You are making me sound like 30+ person man . com'on .I was just fooling around with loote . loote yep AI is the class i learnt Lisp and i hate it.I have no use for that crap.Matlab is fun.Writing C functions to connect with Access???I would probablly go with VB that is much easier.

And MIT hahaha Some what MIT??its a secret:)

Any access experts???
 
Posted on 06-20-06 11:33 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

loote,
k garne ta. "OLD IS GOLD" FORTRAN bata C ma janu ta kati tension hunchha.. tesh mathi VB re bho aaba ..
tesaile.. MATLAB use garne lai MATLAB ko C extension use garera.. form banaune bhaneko ni.... (O:


Actually, using JAVA its very easy by creating an applet. 1 simple program done (O:.
 
Posted on 06-20-06 11:40 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

ok i m nearly maxing out with both my ids. so dont mind me if u dont see my reply again.

With Matlab and C's extension, it will take at least 100 lines of codes to create a simple form with a text box and a button (i m not sure how IMI's forms are demanding for the outlook)

then connectivity with access from C...man you are asking for more codes here.


VB is the easiest platform for RAD (Rapid application development). you can create a form right away in minutes and plus the ODBC is all inbuilt in the IDE itself. so i am telling him to go for this.


With Java, sure. but again u need to have a hands on experience with basic java, a little bit of OOP knowledge so that is not gonna help much. If IMI knows Java then fine.


Loote
 
Posted on 06-20-06 11:52 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

loote,
using 2 ids.. dyamn... what' sthe other one dawg (O:
 
Posted on 06-20-06 11:52 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

and one more thing.

I wont say nything abt fortran coz its pretty outdated now. but lisp is way way powerful. i am not 100% sure if it actually supports browser feature but when it comes to Artificial intelligence Programming I prefer it to C. so its not an OLDY by any means.

talking abt oildies, no one uses java applet these days for web programming, (it used to be in the 90's :P). people go for servlet and JSP these days coz its more secure, latency is less, and more applicable for distributed environment. If you know STRUTS in java then you prolly know what i m talking abt.

Loote.

P.S,. I m not a CS major either

I hope i have not maxed out. Finger crossed
 
Posted on 06-20-06 11:55 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

thapap I now need to use my Nancy Drew inspired brain. You know what I mean don't ya?:@
 
Posted on 06-20-06 11:57 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

flippu,
u need 2 go read ur email and respond kya.. (O: ... that's what nancy drew wud do
 
Posted on 06-23-06 6:24 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

Ah...programming is such an art...

You can easily convert this Java code into C if you wish; I'm just not sure why your lecturer is wanting you to do this in C in the first place. C is good for anything 'networking'; for high level stuff like this well...you're looking at a high level language...

 

package com.sajha.hr.payroll;

import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Hashtable;

/**
* @author JavaBeans
*
*/
public class CalcPay {
private static BufferedReader keyboard;

public static void main( String args[] ) throws IOException {
keyboard =
new BufferedReader(
new InputStreamReader( System.in ));
System.out.println("Enter Employee ID (a number):");

boolean exit=false;
do {
try {
switch( checkValidNum() ) {
case 1:
calcMgr(); break;
case 2:
calcHourly(); break;
case 3:
calcCom(); break;
case 4:
outsrcWork(); break;
default: throw new PayrlException();
}
exit=true;
} catch ( PayrlException pe) {
System.err.println("ID's range must " +
"be within 1-4. Try again.");
}
} while( !exit );
}

static void calcMgr() throws IOException {
System.out.println("Enter the Manager's " +
"fixed weekly salary (a number):");
System.out.println(
"The managers's gross weekly " +
"income is $" + checkValidNum() + ". Bye!");
}

static void calcHourly() throws IOException {
System.out.println("Enter the hourly worker's " +
"fixed hourly wage (a number):");
int wage = checkValidNum();

System.out.println("Now enter the number of hours " +
"they've worked for the week:");
int hours = checkValidNum();

double hrlyPay=0;
if( hours > 40 ) {
hrlyPay=(wage*40) + ((wage*1.5)*(hours-40));
}else{
hrlyPay=wage*hours;
}
System.out.println(
"The hourly worker's gross weekly " +
"income is $" + hrlyPay + ". Bye!");
}

static void calcCom() throws IOException {
System.out.println("Enter the commission worker's " +
"weekly sales (a number):");
System.out.println(
"The commission worker's gross weekly " +
"income is $" + (250+(.057*checkValidNum())) + ". Bye!");
}

static void outsrcWork() throws IOException {
System.out.println("Enter the item no that was " +
"outsourced or contracted:");
int num=0;

//simple storage of values
Hashtable item =
new Hashtable();
item.put("1", "1000");
item.put("2", "2000");
item.put("3", "3000");
item.put("4", "4000");
//etc..
boolean exit=false;
do{
try {
num = checkValidNum();
if( num>4 ) {
throw new PayrlException();
} else {
exit=true;
}
} catch( PayrlException pe ) {
System.err.println("Item range must " +
"be within 1-4. Try again.");
}

} while( !exit );
System.out.println(
"The contractor's gross weekly " +
"income is $" + item.get(String.valueOf(
num )) + ". Bye!");
}

static int checkValidNum() throws IOException {
int num=-1;
boolean exit=false;
do {
try {
num= Integer.parseInt( keyboard.readLine());
exit=true;
} catch( NumberFormatException nfe ) {
System.err.println("I said a number! Try again: ");
}
}while(!exit);
return num;
}
}

class PayrlException extends Exception {
public PayrlException() {
super();
}
}



Cheers!
 



PAGE: <<  1 2  
Please Log in! to be able to reply! If you don't have a login, please register here.

YOU CAN ALSO



IN ORDER TO POST!




Within last 30 days
Recommended Popular Threads Controvertial Threads
TPS Re-registration case still pending ..
ढ्याउ गर्दा दसैँको खसी गनाउच
To Sajha admin
I hope all the fake Nepali refugee get deported
and it begins - on Day 1 Trump will begin operations to deport millions of undocumented immigrants
Travel Document for TPS (approved)
All the Qatar ailines from Nepal canceled to USA
MAGA मार्का कुरा पढेर दिमाग नखपाउनुस !
NOTE: The opinions here represent the opinions of the individual posters, and not of Sajha.com. It is not possible for sajha.com to monitor all the postings, since sajha.com merely seeks to provide a cyber location for discussing ideas and concerns related to Nepal and the Nepalis. Please send an email to admin@sajha.com using a valid email address if you want any posting to be considered for deletion. Your request will be handled on a one to one basis. Sajha.com is a service please don't abuse it. - Thanks.

Sajha.com Privacy Policy

Like us in Facebook!

↑ Back to Top
free counters