473,395 Members | 2,253 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Java Program

I need some java programming help from someone to fix the SalonReport below:





Expand|Select|Wrap|Line Numbers
  1. import java.util.Scanner;
  2. import java.util.Arrays;
  3.  
  4. public class SalonReport {
  5.  
  6.     public static void main(String[] args) {
  7.  
  8.                 int choice;
  9.                 Scanner sc = new Scanner(System.in);
  10.         Service[] services = new Service[5];
  11.  
  12.         services[0] = new Service("Cut", 8.00, 15);    
  13.         services[1] = new Service("Shampoo",4, 10);
  14.         services[2] = new Service("Manicure",18,30);
  15.         services[3] = new Service("Style",48,55);
  16.         services[4] = new Service("Permanent",18,35);
  17.         services[5] = new Service("Trim",6,5);
  18.  
  19.                 System.out.println("Enter how you would like the services sorted (1) Description   (2) Price   (3) Time: ");
  20.                 choice = sc.nextInt;
  21.  
  22.                  //if choice = 1 then sort by description...
  23.                  //if choice = 2 then sort by price....
  24.                  //if choice = 3 then sort by Time...
  25.  
  26.  
  27.  
  28.  
  29.     }
  30. }
  31.  
  32.  
  33.  
  34. public class Service {
  35.  
  36.     String description;
  37.     double price;
  38.     int minutes;
  39.  
  40.     public Service(String d, double p, int m) {
  41.  
  42.         description = d;
  43.         price = p;
  44.         minutes = m;
  45.  
  46.     }
  47.  
  48.     public String getDescription() {
  49.  
  50.         return description;
  51.  
  52.     }
  53.  
  54.     public double getPrice() {
  55.  
  56.         return price;
  57.  
  58.     }
  59.  
  60.     public int getMinutes() {
  61.  
  62.         return minutes;
  63.  
  64.     }
  65. }
Apr 6 '08 #1
3 2054
Nepomuk
3,112 Expert 2GB
I need some java programming help from someone to fix the SalonReport below:
Expand|Select|Wrap|Line Numbers
  1. import java.util.Scanner;
  2. import java.util.Arrays;
  3.  
  4. public class SalonReport {
  5.  
  6.     public static void main(String[] args) {
  7.  
  8.                 int choice;
  9.                 Scanner sc = new Scanner(System.in);
  10.         Service[] services = new Service[5];
  11.  
  12.         services[0] = new Service("Cut", 8.00, 15);    
  13.         services[1] = new Service("Shampoo",4, 10);
  14.         services[2] = new Service("Manicure",18,30);
  15.         services[3] = new Service("Style",48,55);
  16.         services[4] = new Service("Permanent",18,35);
  17.         services[5] = new Service("Trim",6,5);
  18.  
  19.                 System.out.println("Enter how you would like the services sorted (1) Description   (2) Price   (3) Time: ");
  20.                 choice = sc.nextInt;
  21.  
  22.                  //if choice = 1 then sort by description...
  23.                  //if choice = 2 then sort by price....
  24.                  //if choice = 3 then sort by Time...
  25.  
  26.  
  27.  
  28.  
  29.     }
  30. }
  31.  
  32.  
  33.  
  34. public class Service {
  35.  
  36.     String description;
  37.     double price;
  38.     int minutes;
  39.  
  40.     public Service(String d, double p, int m) {
  41.  
  42.         description = d;
  43.         price = p;
  44.         minutes = m;
  45.  
  46.     }
  47.  
  48.     public String getDescription() {
  49.  
  50.         return description;
  51.  
  52.     }
  53.  
  54.     public double getPrice() {
  55.  
  56.         return price;
  57.  
  58.     }
  59.  
  60.     public int getMinutes() {
  61.  
  62.         return minutes;
  63.  
  64.     }
  65. }
(end of Quote - not in quote tags because of tag bug)

First of all: Wrong section. You want the Java Forum.
Secondly: Please state, what exactly your problem is. What should the program do? What does it do? Are there any errors given? If so, what are these errors?
Last, but not least: Please use CODE tags, when posting code. As you see above, it makes code so much easier to read.

Greetings,
Nepomuk
Apr 8 '08 #2
acoder
16,027 Expert Mod 8TB
Moved to the Java forum where you've got more chance of getting help with your problem than the Editor's Corner.

Moderator.
Apr 8 '08 #3
sukatoa
539 512MB
Yes, what is your question? :)
Apr 8 '08 #4

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

Similar topics

73
by: RobertMaas | last post by:
After many years of using LISP, I'm taking a class in Java and finding the two roughly comparable in some ways and very different in other ways. Each has a decent size library of useful utilities...
114
by: Maurice LING | last post by:
This may be a dumb thing to ask, but besides the penalty for dynamic typing, is there any other real reasons that Python is slower than Java? maurice
11
by: DrUg13 | last post by:
In java, this seems so easy. You need a new object Object test = new Object() gives me exactly what I want. could someone please help me understand the different ways to do the same thing in...
30
by: Mike Cox | last post by:
Hi. I recently ran a benchmark against two simple programs, one written in Java and the other in C++. The both accomplish the same thing, outputting "Hello World" on my screen. The C++ program...
1
by: David Van D | last post by:
Hi there, A few weeks until I begin my journey towards a degree in Computer Science at Canterbury University in New Zealand, Anyway the course tutors are going to be teaching us JAVA wth bluej...
1
by: =?Utf-8?B?S2Vubnk=?= | last post by:
I have one bat file that contains a command to startup Java Program. Then, I would like to create a cluster job to call the bat file. In case of one computer is down, another computer can also call...
6
by: aureao4 | last post by:
I'm new to Java and programming. I'm trying to code a payroll program and continue getting errors. The program worked last week, this week I have to add set, get and a class. I've written the class...
5
by: r035198x | last post by:
Setting up. Getting started To get started with java, one must download and install a version of Sun's JDK (Java Development Kit). The newest release at the time of writting this article is...
0
by: markthien | last post by:
Hi guys, I was trying to compile jasper report from java as below: public static void runReport(String databaseName, String userName, String password, String reportFile) {...
0
Debadatta Mishra
by: Debadatta Mishra | last post by:
Introduction In this article I will provide you an approach to manipulate an image file. This article gives you an insight into some tricks in java so that you can conceal sensitive information...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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,...
0
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...

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.