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 ATLPROG Your Own Question

ATLPROG
ATLPROG, Computer Software Engineer
Category: Programming
Satisfied Customers: 9151
Experience:  MS in IT.Several years of programming experience in Java C++ C C# Python VB Javascript HTML
44910485
Type Your Programming Question Here...
ATLPROG is online now
A new question is answered every 9 seconds

need to write a conversion code to convert ounces to grams,

Resolved Question:

need to write a conversion code to convert ounces to grams, grams to pounds, pounds to kiliograms, tons to mega tons, then convert each back, eg. "ounces to grams, grams to ounces.

im a student. wrote the code for each conversion and it works.

problem.. need it to b user friendly. need the program to loop 4 user, a menu 4 the user to choose an option, and a sentinel to end program.
very new @ this. need to see the code to copy into my program. can u help?
Submitted: 5 years ago.
Category: Programming
Expert:  ATLPROG replied 5 years ago.
Hi Welcome to Just Answer, It will be my pleasure to help you.

What programming language is this ?

Can you please send me a pdf/word document/URL of your assignment description ?
Customer: replied 5 years ago.

no help yet...

 

unbeleivable week) :

my flash drive not connecting with school computer.

 

need a conversion program. convert ounces to grams. grams to kilograms. Pounds to kilograms. tons to metric tons. then i need them to convert back again. i need the program to loop so the user can select what conversion to choose from a menu. a way the user can continue selecting or terminate the progam.

Expert:  ATLPROG replied 5 years ago.
What programming language is this ?
Customer: replied 5 years ago.

i

john, this is what i have.

 

 

 

# XXXXX to metric conversion chart.

 

#--- ounces to gram/s.


def conversion():


#--- convert ounces to grams.


raw_input ("conversion chart menu")

input= ("ounces, grams, pounds, kilograms, tons, metricTons")

print "choose an option."

raw_input ("enter 1 to convert ounces to grams"),
"enter 2 to convert grams to ounces."),
"enter 3 to covert pounds to kilograms.",
"enter 4 to convert kilograms to pounds.",
"enter 5 to convert tons to metric tons.",
"enter 6 to convert metric tons to tons."


print "enter number 1 to convert ounces to grams"
ozGrams = input ("enter weight")
ozConvert = (ozGrams * 28.375)
print ozGrams, "ounces convert to"
print "grams equals", ozConvert

#--- convert grams to ounces.

print "enter number 2 to covert grams to ounces"
gramsOz = input ("enter weight")
gramsConvert = (gramsOz / 28.375)
print gramsOz, "grams convert to"
print "oncnes equals", gramsConvert

#--- pounds to kilograms.

print " enter number 3 to convert pounds to kilograms"
lbsKilo = input ("enter weight")
lbsConvert = (lbsKilo * 0.454)
print lbskilo, "pounds convert to"
print "kilograms equals", convert

#--- kilograms to pounds.

print "enter number 4 to convert kilograms to pounds"
kiloLbs = input ("enter weight")
kiloConvert = (kiloLbs / 0.454)
print kiloLbs, "kilograms convert to"
print "kilograms equals", convert


#--- tons to metric tons.

print "enter number 5 to convert tons to metric tons"
tonMton = input ("enter weight")
tonConvert = (tonMton * 0.907)
print tonMton, "ton convert to"
print "metric ton", convert

#--- metric tons to tons.

print "enter number 6 to convert metric tons to tons"
mtonTon = input ("enter weight")
mtonConvert = (mtonTon / 0.907)
print mtonTon, "mton convert to"
print "ton", convert

conversion()




Customer: replied 5 years ago.

resending what i have written in py program.

 

 

# XXXXX to metric conversion chart.

#--- ounces to gram/s.


def conversion():


#--- convert ounces to grams.


raw_input ("conversion chart menu")

input= ("ounces, grams, pounds, kilograms, tons, metricTons")

print "choose an option."

raw_input ("enter 1 to convert ounces to grams"),
"enter 2 to convert grams to ounces."),
"enter 3 to covert pounds to kilograms.",
"enter 4 to convert kilograms to pounds.",
"enter 5 to convert tons to metric tons.",
"enter 6 to convert metric tons to tons."


print "enter number 1 to convert ounces to grams"
ozGrams = input ("enter weight")
ozConvert = (ozGrams * 28.375)
print ozGrams, "ounces convert to"
print "grams equals", ozConvert

#--- convert grams to ounces.

print "enter number 2 to covert grams to ounces"
gramsOz = input ("enter weight")
gramsConvert = (gramsOz / 28.375)
print gramsOz, "grams convert to"
print "oncnes equals", gramsConvert

#--- pounds to kilograms.

print " enter number 3 to convert pounds to kilograms"
lbsKilo = input ("enter weight")
lbsConvert = (lbsKilo * 0.454)
print lbskilo, "pounds convert to"
print "kilograms equals", convert

#--- kilograms to pounds.

print "enter number 4 to convert kilograms to pounds"
kiloLbs = input ("enter weight")
kiloConvert = (kiloLbs / 0.454)
print kiloLbs, "kilograms convert to"
print "kilograms equals", convert


#--- tons to metric tons.

print "enter number 5 to convert tons to metric tons"
tonMton = input ("enter weight")
tonConvert = (tonMton * 0.907)
print tonMton, "ton convert to"
print "metric ton", convert

#--- metric tons to tons.

print "enter number 6 to convert metric tons to tons"
mtonTon = input ("enter weight")
mtonConvert = (mtonTon / 0.907)
print mtonTon, "mton convert to"
print "ton", convert

conversion()




Expert:  ATLPROG replied 5 years ago.
What version of pythion is this ?

When do you need it answered ?
Customer: replied 5 years ago.

py 2.5

need asap

Expert:  ATLPROG replied 5 years ago.
Can you please send me a pdf/word document/URL of your assignment description ?
Customer: replied 5 years ago.

# XXXXX to metric conversion chart.

#--- ounces to gram/s.


def conversion():


#--- convert ounces to grams.


raw_input ("conversion chart menu")

input= ("ounces, grams, pounds, kilograms, tons, metricTons")

print "choose an option."

raw_input ("enter 1 to convert ounces to grams"),
"enter 2 to convert grams to ounces."),
"enter 3 to covert pounds to kilograms.",
"enter 4 to convert kilograms to pounds.",
"enter 5 to convert tons to metric tons.",
"enter 6 to convert metric tons to tons."


print "enter number 1 to convert ounces to grams"
ozGrams = input ("enter weight")
ozConvert = (ozGrams * 28.375)
print ozGrams, "ounces convert to"
print "grams equals", ozConvert

#--- convert grams to ounces.

print "enter number 2 to covert grams to ounces"
gramsOz = input ("enter weight")
gramsConvert = (gramsOz / 28.375)
print gramsOz, "grams convert to"
print "oncnes equals", gramsConvert

#--- pounds to kilograms.

print " enter number 3 to convert pounds to kilograms"
lbsKilo = input ("enter weight")
lbsConvert = (lbsKilo * 0.454)
print lbskilo, "pounds convert to"
print "kilograms equals", convert

#--- kilograms to pounds.

print "enter number 4 to convert kilograms to pounds"
kiloLbs = input ("enter weight")
kiloConvert = (kiloLbs / 0.454)
print kiloLbs, "kilograms convert to"
print "kilograms equals", convert


#--- tons to metric tons.

print "enter number 5 to convert tons to metric tons"
tonMton = input ("enter weight")
tonConvert = (tonMton * 0.907)
print tonMton, "ton convert to"
print "metric ton", convert

#--- metric tons to tons.

print "enter number 6 to convert metric tons to tons"
mtonTon = input ("enter weight")
mtonConvert = (mtonTon / 0.907)
print mtonTon, "mton convert to"
print "ton", convert

conversion()




Expert:  ATLPROG replied 5 years ago.
Can you please send me a pdf/word document/URL of your assignment description ?

I need to understand what your program needs to do
Customer: replied 5 years ago.

this is a program i wrote in python 2.5. i need a menu for it to b user friendly. also need it to loop 1 through 6 options, and a way to terminate program 4 the user.

 

 

def conversion()

 

print "enter number 1 to convert ounces to grams"
ozGrams = input ("enter weight")
ozConvert = (ozGrams * 28.375)
print ozGrams, "ounces convert to"
print "grams equals", ozConvert

 

#--- convert grams to ounces.

print "enter number 2 to covert grams to ounces"
gramsOz = input ("enter weight")
gramsConvert = (gramsOz / 28.375)
print gramsOz, "grams convert to"
print "oncnes equals", gramsConvert

#--- pounds to kilograms.

print " enter number 3 to convert pounds to kilograms"
lbsKilo = input ("enter weight")
lbsConvert = (lbsKilo * 0.454)
print lbskilo, "pounds convert to"
print "kilograms equals", convert

#--- kilograms to pounds.

print "enter number 4 to convert kilograms to pounds"
kiloLbs = input ("enter weight")
kiloConvert = (kiloLbs / 0.454)
print kiloLbs, "kilograms convert to"
print "kilograms equals", convert


#--- tons to metric tons.

print "enter number 5 to convert tons to metric tons"
tonMton = input ("enter weight")
tonConvert = (tonMton * 0.907)
print tonMton, "ton convert to"
print "metric ton", convert

#--- metric tons to tons.

print "enter number 6 to convert metric tons to tons"
mtonTon = input ("enter weight")
mtonConvert = (mtonTon / 0.907)
print mtonTon, "mton convert to"
print "ton", convert

conversion()


Expert:  ATLPROG replied 5 years ago.
ok
Customer: replied 5 years ago.

ATLPROG i need to leave school campus. will check mail when home. sure keeping fingers cross program i sent came through in a readable format.

 

school's PC's are abused and out-dated. surprised i got my memory stick to work. if u can rework or rewite this program, then send it to my hotmail account.

 

Barbara

Expert:  ATLPROG replied 5 years ago.
Barbara,


I can't send emails through this website. But I will leave you a message when I am done
Customer: replied 5 years ago.

k... home. this is my graduation project. degree in computer networking.

if u can get this program 2 run, will grad w 3.5+ this mouth. will give u a very nice tip 4 ur time/work. check back soon....

Expert:  ATLPROG replied 5 years ago.
Alright ! :)
Expert:  ATLPROG replied 5 years ago.
Please download the answer from this Answer_Link

Let me know if you need any changes
Expert:  ATLPROG replied 5 years ago.
Please do click the Green accept button if you think my answer helped, so that I get paid for the time spent. I would obviously continue to help you if you have any further questions.
Customer: replied 5 years ago.
need 2 run it on my PC. give my a couple min 2 get back 2 ya.
Expert:  ATLPROG replied 5 years ago.
ok...if you have any changes just let me know...I am not sure if I did it per your assignment as I did not have any assignment details.
Customer: replied 5 years ago.

the loop works! i just need a display message 4 da user telling the

 

"this is a metric conversion program"

"enter 1 to convert..., 2, 3," ...so on

 

and a display mess telling the user "to exit the progam enter "y" or "no"

 

can u do that?

 

Expert:  ATLPROG replied 5 years ago.
ok...let me work on it and get back to you tonight or tomorrow...
Customer: replied 5 years ago.

k....leaving 4 school tomorrow @ 7am. check mail before bed, an morning.

 

i almost had it ?!? good thing im not in programming. this is the hardest course i had to take. ttyl..barb

Expert:  ATLPROG replied 5 years ago.
check back in a hour...
Expert:  ATLPROG replied 5 years ago.
here ?
Expert:  ATLPROG replied 5 years ago.
Please download the answer from this Answer_Link
Customer: replied 5 years ago.
going to check it out
Expert:  ATLPROG replied 5 years ago.
ok
Customer: replied 5 years ago.

here is a problem, when i enter 1, all good. does not promt user 4 option 2,3,4,5,6.

 

enter number 1 to convert ounces to grams

enter number 2 to covert grams to ounces

enter number 3 to convert pounds to kilograms

enter number 4 to convert kilograms to pounds

enter number 5 to convert tons to metric tons

enter number 6 to convert metric tons to tons

enter number 9 to quit

 

Type in a number (1-9):

enter number 9 to quit2

Traceback (most recent call last):

File "E:\MetricConversionProgram_2.py", line 70, in

conversion()

File "E:\MetricConversionProgram_2.py", line 18, in conversion

menu_choice = int(input("Type in a number (1-9): "))

File "", line 2

enter number 9 to quit2

^

IndentationError: unexpected indent

>>>

 

Expert:  ATLPROG replied 5 years ago.
You must have modified the file I gave you. Did you copy paste the file properly ?
Expert:  ATLPROG replied 5 years ago.
Are you there ?

You must have modified the file I gave you. Did you copy paste the file properly ?
Customer: replied 5 years ago.
yes
Expert:  ATLPROG replied 5 years ago.
It works just fine....I can send you screenshots if needed. This is ahppening as you have probably not copy pasted it correctly or you are still runnning the old program
Customer: replied 5 years ago.

can u send it again. ill give it another try

Expert:  ATLPROG replied 5 years ago.
Please download the answer from this Answer_Link
Customer: replied 5 years ago.
b right back
Customer: replied 5 years ago.
cannot copy an past. this PC doesnt have .py, so i cant save in in that formatXXXXX then transfer to other PC. please send in format, not .doc
Expert:  ATLPROG replied 5 years ago.
I did not send it in .doc format at all.


I sent you the python code, you can copy paste it into your python file.



Expert:  ATLPROG replied 5 years ago.
Try COPY-PASTE into your python file from this link

Answer_Link

ATLPROG and other Programming Specialists are ready to help you
Customer: replied 5 years ago.
no, im on another pc that cannot save file as a ,py. need py format if u still have it
Expert:  ATLPROG replied 5 years ago.
Please download the Python file from this Answer_Link
Customer: replied 5 years ago.
b bak
Expert:  ATLPROG replied 5 years ago.
ok...let me know when you have it downloaded. Please do not modify any code in this python file
Customer: replied 5 years ago.

this is the output when a user tries to enter another option.

 

enter number 1 to convert ounces to grams

enter number 2 to covert grams to ounces

enter number 3 to convert pounds to kilograms

enter number 4 to convert kilograms to pounds

enter number 5 to convert tons to metric tons

enter number 6 to convert metric tons to tons

enter number 9 to quit

 

Type in a number (1-9): 2

enter weight 33

33 grams convert to

ounces equals 1.16299559471

 

 

enter number 1 to convert ounces to grams

enter number 2 to covert grams to ounces

enter number 3 to convert pounds to kilograms

enter number 4 to convert kilograms to pounds

enter number 5 to convert tons to metric tons

enter number 6 to convert metric tons to tons

enter number 9 to quit

 

Type in a number (1-9): 4

 

Expert:  ATLPROG replied 5 years ago.
And.....What is wrong with this ?

Related Programming Questions