How JustAnswer Works:

  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site.
    Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.

Ask Raj Your Own Question

Raj
Raj, Engineer
Category: Homework
Satisfied Customers: 1282
Experience:  4 + Experiance in IT Industry
16752232
Type Your Homework Question Here...
Raj is online now
A new question is answered every 9 seconds

I am using netbeans and am trying to create a program that

Resolved Question:

I am using netbeans and am trying to create a program that estimates the download time using java.

It must say:

Welcome to the Download Time Estimator

Enter file size (MB) :
Enter download speed (MB/Sec):

This download will take approximately 0 hours 0 minutes 0 seconds

Continue? (y/n) :

I'm having trouble with this one.
Submitted: 3 years ago.
Category: Homework
Expert:  Raj replied 3 years ago.
Hi There,

I will be helping you with the code.
Let me know the deadline?
Also if you want me to use any code than please provide it.

Thank you
Customer: replied 3 years ago.

hi Raj, I need it today please. I have the opening code kind of:

 

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

/**
*
* @author john
*/
public class DownloadTimeApp {

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
}
}

 

That's all I have!

Expert:  Raj replied 3 years ago.
Ok John If you can stay Online for next 1 hr. than I can provide you the solution now itself.
Customer: replied 3 years ago.

ok thanks

 

Expert:  Raj replied 3 years ago.
Below is the Solution code John.

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

/**
*
* @author john
*/
import java.util.Scanner;

public class DownloadTimeApp
{
/**
* @param args the command line arguments
*/
public static void main(String[] args)
{
// TODO code application logic here
Scanner input = new Scanner(System.in);
int hr,min,sec,time;
double size,speed;
char cont;

System.out.println("Welcome to the Download Time Estimator\n");

do
{
System.out.print("Enter file size (MB) : ");
size = input.nextDouble();
System.out.print("Enter download speed (MB/Sec): ");
speed = input.nextDouble();

time = (int)(size / speed);

hr = time / (3600);
time = time - (hr * 3600);
min = time / 60;
time = time - (min * 60);
sec = time;

System.out.println("This download will take approximately "+hr+" hours "+min+" minutes "+sec+" seconds");
System.out.print("Continue? (y/n) : ");
cont = input.next().toUpperCase().charAt(0);
}while(cont != 'N');
}
}

//---------------------------------------------------------------------------------------------------

If you face any difficulty than feel free to ask for help.

If the solution file is satisfactory than Please don't forget to RATE the Answer.
It will hardly take few seconds to RATE my Answer

Thank You and Have a Good Day.
Customer: replied 3 years ago.
hi. everything is good except it actually has to calculate the hours minutes and seconds out 2 decimal place; the 0, 0, 0 was just an example
Expert:  Raj replied 3 years ago.
THIS ANSWER IS LOCKED!

You need to spend $3 to view this post. Add Funds to your account and buy credits.
Raj and 5 other Homework Specialists are ready to help you