[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 10242 TIMES]
SAVE! for ease of future access.
The postings in this thread span 2 pages, View 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)
 
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 365 days
Recommended Popular Threads Controvertial Threads
श्राद्द
TPS Re-registration
TPS Re-registration case still pending ..
What are your first memories of when Nepal Television Began?
निगुरो थाहा छ ??
ChatSansar.com Naya Nepal Chat
Lets play Antakshari...........
Basnet or Basnyat ??
Sajha has turned into MAGATs nest
NRN card pros and cons?
TPS EAD auto extended to June 2025 or just TPS?
is Rato Bangala school cheating?
मेरो अम्रिका यात्रा -२
Do nepalese really need TPS?
कता जादै छ नेपाली समाज ??
susta manasthiti lai ke bhanchan english ma?
Nas and The Bokas: Coming to a Night Club near you
मन भित्र को पत्रै पत्र!
Will MAGA really start shooting people?
Democrats are so sure Trump will win
Nas and The Bokas: Coming to a Night Club near you
Mr. Dipak Gyawali-ji Talk is Cheap. US sends $ 200 million to Nepal every year.
Harvard Nepali Students Association Blame Israel for hamas terrorist attacks
TPS Update : Jajarkot earthquake
is Rato Bangala school cheating?
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