473,978 Members | 2,606 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Adding Inclusivness to my program

47 New Member
I have designed a program according to the specifications required except for two things! I need to somehow set a 70 hour limit to the HE employees hours worked, and the weeks should be no less than 1 and no greater then 52. Can anyone help me?

Here is my Program! Thanks in advance! ALI :P

import java.util.*;

public class Project2
{
public static void main(String[] args)
{
Scanner stdin = new Scanner(System. in);

// get user input data
System.out.prin t("Please enter week number for current pay period: ");
int week = stdin.nextInt() ;

System.out.prin t("Please enter employees name: ");
String name = stdin.next();

System.out.prin t("Please enter employee's type (HE, SA, PA): ");
String type = stdin.next();

// calculate HE salary and display it on the screen.
if (type.compareTo IgnoreCase("HE" ) == 0) {
System.out.prin t("Please enter number of hours worked this week: ");
int hours = stdin.nextInt() ;
System.out.prin t("Please enter the hourly salary of this employee: $ ");
double salary = stdin.nextDoubl e();
double hourlypay = hours * salary;
System.out.prin tln("Week #: " + week);
System.out.prin tln("Employee name: " + name);
System.out.prin tln("Employee type: " + type);
System.out.prin tln("Hourly Salary: $" + salary);
System.out.prin tln("Number of worked hours: " + hours);
System.out.prin tln("Salary due: $" + hourlypay);
}
else if (type.compareTo IgnoreCase("SA" ) == 0) {
System.out.prin t(" Please enter employees base weekly salary: $ ");
double base = stdin.nextDoubl e();
System.out.prin t("How many items were sold by this employee this week? ");
int items = stdin.nextInt() ;
System.out.prin t("What is the current commission value of these items? $ ");
double commission = stdin.nextDoubl e();
double salarypay = (items * commission) + base;
System.out.prin tln("Week #: " + week);
System.out.prin tln("Employee name: " + name);
System.out.prin tln("Employee type: " + type);
System.out.prin tln("Base weekly salary: $" + base);
System.out.prin tln("Commission price per item: $ " + commission);
System.out.prin tln("Number of items sold this week: " + items);
System.out.prin tln("Salary due: $" + salarypay);
}
else if (type.compareTo IgnoreCase("PA" ) == 0) {
System.out.prin t("Please enter the wage per piece price paid to this employee: $ ");
double price = stdin.nextDoubl e();
System.out.prin t("How many pieces did this worker produce this week?: ");
int pieces = stdin.nextInt() ;
double pieceSalary = price * pieces;
System.out.prin tln("Week #: " + week);
System.out.prin tln("Employee name: " + name);
System.out.prin tln("Employee type: " + type);
System.out.prin tln("Wages per piece: $" + price);
System.out.prin tln("Number of pieces produced this week: " + pieces);
System.out.prin tln("Salary due: $" + pieceSalary);
}

}
}
May 13 '07 #1
0 1221

Sign in to post your reply or Sign up for a free account.

Similar topics

16
3218
by: Picho | last post by:
Hi all, Is there any .NET way (I am not rulling out API usage) to add button(s) to a form's title bar? I found some non-.NET solutions that did actually work in VB6 but not in the ..NET forms... I tried painting, but the paintaing area provided by the form is only the client area - no visible way to paint on the title bar.
10
4037
by: Eric Petruzzelli | last post by:
If I fill my dataset and there is no data. The dataset is still created with zero rows (all columns are there). When I add my first row using the script below, it takes over 2 seconds to add??? If I add the second row, instant. How can I eliminate this delay?
10
2725
by: sp0 | last post by:
Is there a reason why to make mix numbers improper when adding? It seems when subtracting and adding, adding a subtracting the whole numbers and fraction parts should be sufficient? what'ch think
5
5946
by: surrealtrauma | last post by:
the requirement is : Create a class called Rational (rational.h) for performing arithmetic with fractions. Write a program to test your class. Use Integer variables to represent the private data of the class – the numerator and the denominator. Provide a constructor that enables an object of this class to be initialized when it is declared. The constructor should contain default values in case no initializers are provided and should...
2
3742
by: avivgur | last post by:
Hello, I am writing a program in Visual C# and I have encountered a problem. In my program I want to dynamically create a multitude of controls (thousands) on a form. The problem is that calling the Controls.Add() method several times or even calling the Controls.AddRange() method once can take a huge amount of time. Therefore, I would like to be able to run the loop that creates the controls on a different thread and meanwhile give the user...
7
5453
by: Wysiwyg | last post by:
Is there any way to add an embedded resource to a project without copying it to the project's directory? I have shared resources and don't want each project using the images, xml files, etc. to need to be updated with the current copy before being built. I also don't want projects being built with the old copy. Thanks! Bill
0
2419
by: Luis Esteban Valencia | last post by:
Hello I wrote a program with code behind in C# to add row into table dynamically and the program worked very well in .Net Framework 1.1. When I run this program in .Net Framework 2.0 beta version, the program is not working as in version 1.1. So what is the problem? Microsoft declared that the version 2.0 is fully backward support, but it is not. Is that the problem with 2.0 version? I find out the problem in version 2.0. After...
2
2033
by: Landen | last post by:
I am wanting to replicate a linux feature that I can't seem to find anywhere in windows as an addin or program. If anyone is familiar with linux, if you right click on a folder or file, you get the option to send to any other folder on your hard drive. For example, if I had a file on my desktop that I wanted to send to C:\Windows\system32\DirectX\Dinput, I wou;d have to open an explorer windows and navigate there I could just right click...
5
4473
by: DBC User | last post by:
I have a situation, where I need to add 4 or 5 data files (they change every time I build) in my project during build time and somehow I need a way to access these files during runtime. So I have 2 questions 1. Is it possible to identify all the files in the resource file during runtime by name of the file? 2. Is it possible to add files to a project at build time to make an exe with those files? Thanks.
0
10180
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11837
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
11439
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10923
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
10094
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7622
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6574
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4750
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3776
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.