Find Jobs
Hire Freelancers

LinkedList Java Program Add Multiply Large Numbers

$30-250 USD

Käynnissä
Julkaistu lähes 15 vuotta sitten

$30-250 USD

Maksettu toimituksen yhteydessä
It is sometimes desirable to be able to handle numbers of arbitrary size, without having to consider the limit of the machine representation or to rely on a utility library(e.g., [login to view URL]). A linked list, implemented with pointers and dynamic memory allocation, is a natural solution: we obtain storage to hold digits only when necessary. Such an approach is called infinite precision arithmetic. To represent a large number such as 15,000,701,800,029 with a linked list, we could simply create a node for each digit. However, to make more efficient use of memory, we store an integer between 0 and 999 in each node, which gives the effect of base-1, 000 numbers. For example, the number above can be represented by a five-node list (15, 0, 701, 800, 29 ). You will be provided with a data file called “[login to view URL]” containing several pairs of large numbers. Each number is given on a separate line and there is an empty line between two pairs. You Java program should read and echo each pair of numbers, compute and report their sum and product, and go on to process the next pair until the end of input. Put your solution in the form of a class named LargeNumbers, which uses the Node class to provide nodes for the linked list representation. There should be, among other things, - a method to read from file - a method to put a large number into a linked list - a method to add two large numbers - a method to multiply two large numbers - a method to output a large number The main method must look like this pseudo-code: While( not end of input) { Read and echo a pair of numbers N1 and N2; Output sum (N1, N2) ; Output product(N1, N2); } So here’s a sample output: LargeNumber1: 1 506 033 005 018 000 029 LargeNumber2: 1 992 Sum is: (whatever the sum is) Product is: ( whatever the product is) [login to view URL] file: 1 506 033 005 018 000 029 1 992 9 4 112 233 445 566 778 899 99 887 766 554 433 221 100 198 719 881 989 199 019 911 992 199 319 941 995 141 421 356 0 1 234 567 890 9 999 999 9 999 999 999 999 999 999 999 999 999 1 734 792 131 23 571 100 000 002 750 004 128 293 702 150 000 3 276 765 535 021 271 828 128 450 945 31 415 926 535 31 415 926 535 2 31 415 926 535
Projektin tunnus (ID): 473057

Tietoa projektista

1 ehdotus
Etäprojekti
Aktiivinen 15 vuotta sitten

Haluatko ansaita rahaa?

Freelancerin tarjouskilpailun edut

Aseta budjettisi ja aikataulu
Saa maksu työstäsi
Kuvaile ehdotustasi
Rekisteröinti ja töihin tarjoaminen on ilmaista
Myönnetty käyttäjälle:
Käyttäjän avatar
Hey please check your PMB Thanks
$60 USD 1 päivässä
5,0 (54 arvostelua)
6,1
6,1

Tietoja asiakkaasta

Maan UNITED STATES lippu
bronx, United States
5,0
2
Liittynyt heinäk. 21, 2009

Asiakkaan vahvistus

Kiitos! Olemme lähettäneet sinulle sähköpostitse linkin, jolla voit lunastaa ilmaisen krediittisi.
Jotain meni pieleen lähetettäessä sähköpostiasi. Yritä uudelleen.
Rekisteröitynyttä käyttäjää Ilmoitettua työtä yhteensä
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Ladataan esikatselua
Lupa myönnetty Geolocation.
Kirjautumisistuntosi on vanhentunut ja sinut on kirjattu ulos. Kirjaudu uudelleen sisään.