Write an application that computes the cost of a telephone call. The inputs

are the time the call was placed (this should be written as a 24-hour time, e.g.,

2149 for a call placed a 9:49p.m.), the duration of the call in minutes, and the

distance in miles of the destination of the call. The output is the cost of the

call. Cost is computed as follows:


²

Basic cost is $0.003 per minute per mile.


²

Calls placed between 8am and midnight (800 to 2400) are subject to a 20%


surcharge. (That is, basic cost is increased by 0.2.)


²

A tax of 6% is added to the cost.


The di±cult part of this project is computing the surcharge, if any. To help do


this, use the operation

Math.ceil(E), which returns the nearest integer value


that is not less than

E. For example, Math.ceil(0.2359 - 0.0759) equals 1.0,


but
Math.ceil(0.0630 - 0.0759) equals 0.0.


pls i have this school project for tomorow someone help !

Recommended Answers

All 3 Replies

There are lots of people here who will freely give their time to help you become the best Java programmer you can be. There's nobody here who is interested in doing your homework for you.

DaniWeb Member Rules include:
"Do provide evidence of having done some work yourself if posting questions from school or work assignments"
http://www.daniweb.com/forums/faq.php?faq=daniweb_policies
http://www.daniweb.com/forums/announcement8-2.html

and if you have to enter the assignment tomorrtow, you 've propably had enough time to solve it by now.

public class telCost {
public static void main (String[] args) {
	int time = new Integer(args[0]).intValue();
	
	int calltime = new Integer(args[1]).intValue();
	
	double distance = new Double(args[2]).doubleValue();
	double price = distance* calltime * 0.0003;
	price = price  * (6/price);
	
	if (time > 800 && time < 2400 ) 
		System.out.println(price +0.2);
	else System.out.println(price);
   }
}

this is wat ive done till now , basically i can't understand the problem correctly .. :(

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.