Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Homework Help

Name: Anonymous 2010-12-08 18:29

Dear Prog,

I am deeply sorry for this, I really am. I hate homework threads.

However, I need two points to pass this class that I thought I had passed weeks ago and I have no idea how to do this problem. I really need your help. The solution needs to be in java, and as basic as possible. Again, I am sorry.

Assignment: B. Base Conversion. (4 points) Convert a positive decimal number into another base, and vice versa. Begin by asking whether to convert to or from decimal. Then ask for the number and the non-decimal base b, 2 < b < 10. When you complete the conversion, ask whether or not to do another. For one point of extra credit, let b be as high as 16.

Note that I only need half credit.

Name: Anonymous 2010-12-09 7:09

(defun convert-to-base (base number)
  (let ((*print-base* base))
    (write-to-string number)))
(defun convert-from-base (base string)
  (let ((*read-base* base))
    (read-from-string string)))
(defun decimal-to-base (base string)
  (convert-to-base base (convert-from-base 10 string)))
(defun base-to-decimal (base string)
  (convert-to-base 10 (convert-from-base base string)))


Your welcome.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List