Find Jobs
Hire Freelancers

cancelled duplicate

$30-5000 USD

Closed
Posted about 22 years ago

$30-5000 USD

Paid on delivery
use the jdk 1.3.1_02 i run from the program frm ms dos modify the Fraction programe so it performes a partial input valdiation . If either fraction does not contian exactly one slash , have the program prompt the user to re-enter the fraction . The program will repeat the prompt as often as necessary until the user enters a string containing one slash. ## Deliverables /***** enter first fraction: 3/5 enter second fraction: 1/6 sum: 23/30 Difference :13/30 Product:3/30 Quotient 18/15 ALL OPERATIONS ARE THE CALLING OBJECT op F *****/ import java.io.*; public class Fraction { private int num, den; //Two constructor public Fraction(int n, int d) { num = n; //Numerator den = d; //Denominator if(den < 0) { num *= -1; den *= -1; } } //another constructor //pass the fraction in the string like "1/2" public Fraction(String f) { int i = 0; boolean done = false; while(!done) { if([login to view URL](i) == '/') done = true; else i++; } String n = [login to view URL](0, i); String d = [login to view URL](i+1, [login to view URL]()); Integer i1 = new Integer(n); num = [login to view URL](); Integer i2 = new Integer(d); den = [login to view URL](); if(den == 0) { den *= -1; num *= -1; } } //default constructor public Fraction() { num = 0; den = 1; } //////////////////// //ALL OPERATIONS ARE THE CALLING OBJECT op F // Fraction f; // [login to view URL](f2); is f - f2 /////////////////// public Fraction add(Fraction f) //Add method { Fraction sum = new Fraction(); [login to view URL] = den * [login to view URL]; [login to view URL] = num * [login to view URL] + [login to view URL] * den; return sum; } public Fraction sub(Fraction f) //Subtract method { Fraction dif = new Fraction(); [login to view URL] = den * [login to view URL]; [login to view URL] = num * [login to view URL] - [login to view URL] * den; return dif; } public Fraction mul(Fraction f) //Multiply Method { Fraction prod = new Fraction(); [login to view URL] = den * [login to view URL]; [login to view URL] = num * [login to view URL]; return prod; } public Fraction div(Fraction f) //Divide method { Fraction quot = new Fraction(); [login to view URL] = den * [login to view URL]; [login to view URL] = num * [login to view URL]; return quot; } public void display() { [login to view URL](num); [login to view URL]('/'); [login to view URL](den); [login to view URL](" "); } public static void main(String[] args) { Fraction f1, f2; BufferedReader in = new BufferedReader(new InputStreamReader([login to view URL])); try { Fraction f3 = new Fraction(); [login to view URL]("Enter first fraction: "); //First Prompts for the Input X/Y String tmpstr_f1 = [login to view URL](); f1 = new Fraction(tmpstr_f1); [login to view URL]("Enter second fraction: "); //Second Prompt X/Y String tmpstr_f2 = [login to view URL](); f2 = new Fraction(tmpstr_f2); f3 = [login to view URL](f2); [login to view URL]("Sum :"); //Output of Sum [login to view URL](); f3 = [login to view URL](f2); [login to view URL]("\nDifference :"); //Output of Difference [login to view URL](); f3 = [login to view URL](f2); [login to view URL]("\nProduct :"); //Output of Products [login to view URL](); f3 = [login to view URL](f2); [login to view URL]("\nQuotent :"); //Output of Quotient [login to view URL](); } catch(IOException e) { [login to view URL]("error"); } } } ## Platform OS melenuim ms dos ## Deadline information 02/22/02
Project ID: 2839489

About the project

11 proposals
Remote project
Active 22 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
11 freelancers are bidding on average $17 USD for this job
User Avatar
See private message.
$11.05 USD in 14 days
5.0 (60 reviews)
5.0
5.0
User Avatar
See private message.
$5.95 USD in 14 days
5.0 (35 reviews)
4.3
4.3
User Avatar
See private message.
$8.50 USD in 14 days
5.0 (38 reviews)
4.1
4.1
User Avatar
See private message.
$17 USD in 14 days
4.9 (18 reviews)
3.9
3.9
User Avatar
See private message.
$6.80 USD in 14 days
4.9 (35 reviews)
3.9
3.9
User Avatar
See private message.
$14.45 USD in 14 days
4.5 (33 reviews)
4.2
4.2
User Avatar
See private message.
$12.75 USD in 14 days
4.5 (17 reviews)
3.3
3.3
User Avatar
See private message.
$42.50 USD in 14 days
4.8 (6 reviews)
2.3
2.3
User Avatar
See private message.
$8.50 USD in 14 days
4.0 (2 reviews)
0.5
0.5
User Avatar
See private message.
$51 USD in 14 days
0.0 (0 reviews)
1.1
1.1
User Avatar
See private message.
$5.95 USD in 14 days
0.0 (0 reviews)
0.0
0.0

About the client

Flag of UNITED STATES
United States
5.0
73
Member since Sep 7, 2001

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.