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: 8641
Experience:  MS in IT.Several years of programming experience in Java C++ C C# Python VB Javascript HTML
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: 2 years ago.
Category: Programming
Expert:  ATLPROG replied 2 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 2 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 2 years ago.
What programming language is this ?
Customer: replied 2 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 2 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 2 years ago.
What version of pythion is this ?

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

py 2.5

need asap

Expert:  ATLPROG replied 2 years ago.
Can you please send me a pdf/word document/URL of your assignment description ?
Customer: replied 2 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 2 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 2 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 2 years ago.
ok
Customer: replied 2 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 2 years ago.
Barbara,


I can't send emails through this website. But I will leave you a message when I am done
Customer: replied 2 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 2 years ago.
Alright ! :)
Expert:  ATLPROG replied 2 years ago.
Please download the answer from this Answer_Link

Let me know if you need any changes
Expert:  ATLPROG replied 2 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 2 years ago.
need 2 run it on my PC. give my a couple min 2 get back 2 ya.
Expert:  ATLPROG replied 2 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 2 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 2 years ago.
ok...let me work on it and get back to you tonight or tomorrow...
Customer: replied 2 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 2 years ago.
check back in a hour...
Expert:  ATLPROG replied 2 years ago.
here ?
Expert:  ATLPROG replied 2 years ago.
Please download the answer from this Answer_Link
Customer: replied 2 years ago.
going to check it out
Expert:  ATLPROG replied 2 years ago.
ok
Customer: replied 2 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 2 years ago.
You must have modified the file I gave you. Did you copy paste the file properly ?
Expert:  ATLPROG replied 2 years ago.
Are you there ?

You must have modified the file I gave you. Did you copy paste the file properly ?
Customer: replied 2 years ago.
yes
Expert:  ATLPROG replied 2 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 2 years ago.

can u send it again. ill give it another try

Expert:  ATLPROG replied 2 years ago.
Please download the answer from this Answer_Link
Customer: replied 2 years ago.
b right back
Customer: replied 2 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 2 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 2 years ago.
Try COPY-PASTE into your python file from this link

Answer_Link

ATLPROG, Computer Software Engineer
Category: Programming
Satisfied Customers: 8641
Experience: MS in IT.Several years of programming experience in Java C++ C C# Python VB Javascript HTML
ATLPROG and 2 other Programming Specialists are ready to help you
Customer: replied 2 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 2 years ago.
Please download the Python file from this Answer_Link
Customer: replied 2 years ago.
b bak
Expert:  ATLPROG replied 2 years ago.
ok...let me know when you have it downloaded. Please do not modify any code in this python file
Customer: replied 2 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 2 years ago.
And.....What is wrong with this ?

JustAnswer in the News:

 
 
 
Ask-a-doc Web sites: If you've got a quick question, you can try to get an answer from sites that say they have various specialists on hand to give quick answers... Justanswer.com.
JustAnswer.com...has seen a spike since October in legal questions from readers about layoffs, unemployment and severance.
Web sites like justanswer.com/legal
...leave nothing to chance.
Traffic on JustAnswer rose 14 percent...and had nearly 400,000 page views in 30 days...inquiries related to stress, high blood pressure, drinking and heart pain jumped 33 percent.
Tory Johnson, GMA Workplace Contributor, discusses work-from-home jobs, such as JustAnswer in which verified Experts answer people’s questions.
I will tell you that...the things you have to go through to be an Expert are quite rigorous.
 
 
 

What Customers are Saying:

 
 
 
  • My Expert answered my question promptly and he resolved the issue totally. This is a great service. I am so glad I found it I will definitely use the service again if needed. One Happy Customer New York
< Last | Next >
  • My Expert answered my question promptly and he resolved the issue totally. This is a great service. I am so glad I found it I will definitely use the service again if needed. One Happy Customer New York
  • Wonderful service, prompt, efficient, and accurate. Couldn't have asked for more. I cannot thank you enough for your help. Mary C. Freshfield, Liverpool, UK
  • This expert is wonderful. They truly know what they are talking about, and they actually care about you. They really helped put my nerves at ease. Thank you so much!!!! Alex Los Angeles, CA
  • Thank you for all your help. It is nice to know that this service is here for people like myself, who need answers fast and are not sure who to consult. GP Hesperia, CA
  • I couldn't be more satisfied! This is the site I will always come to when I need a second opinion. Justin Kernersville, NC
  • Just let me say that this encounter has been entirely professional and most helpful. I liked that I could ask additional questions and get answered in a very short turn around. Esther Woodstock, NY
  • Thank you so much for taking your time and knowledge to support my concerns. Not only did you answer my questions, you even took it a step further with replying with more pertinent information I needed to know. Robin Elkton, Maryland
 
 
 

Meet The Experts:

 
 
 
  • ATLPROG

    Computer Software Engineer

    Satisfied Customers:

    7463
    MS in IT.Several years of programming experience in Java C++ C C# Python VB Javascript HTML
< Last | Next >
  • http://ww2.justanswer.com/uploads/SP/spatlanta2010/2011-6-23_12450_photo.64x64.gif ATLPROG's Avatar

    ATLPROG

    Computer Software Engineer

    Satisfied Customers:

    7463
    MS in IT.Several years of programming experience in Java C++ C C# Python VB Javascript HTML
  • http://ww2.justanswer.com/uploads/ComputersGuru/2010-02-13_051118_Photo41.JPG LogicPro's Avatar

    LogicPro

    Computer Software Engineer

    Satisfied Customers:

    5603
    Expert in C, C++, Java, DOT NET, Python, HTML, Javascript, Design.
  • http://ww2.justanswer.com/uploads/unvadim/2010-11-15_210218_avatar.jpg unvadim's Avatar

    unvadim

    Computer Software Engineer

    Satisfied Customers:

    1158
    Good knowledge of OOP principles. 3+ years of programming experience with Java and C++. Sun Certified Java Programmer 5.0.
  • http://ww2.justanswer.com/uploads/lifesaver333/2010-10-17_191349_ls.jpeg lifesaver's Avatar

    lifesaver

    Computer Software Engineer

    Satisfied Customers:

    950
    Several years of intensive programming and application development experience in various platforms.
  • http://ww2.justanswer.com/uploads/EH/ehabtutor/2012-8-2_202016_1.64x64.jpg ehabtutor's Avatar

    ehabtutor

    Computer Software Engineer

    Satisfied Customers:

    864
    Bachelor of computer science, 5+ years experience in software development, software company owner
  • http://ww2.justanswer.com/uploads/RA/rajivsharma086/2012-6-6_17128_displaypic.64x64.jpg Raj's Avatar

    Raj

    Computer Engg.

    Satisfied Customers:

    860
    BE CS, 4+ Experience in Programming and Database (ERP)
  • http://ww2.justanswer.com/uploads/eljonis/2010-01-06_130406_eljon2.jpg Eljon's Avatar

    Eljon

    Consultant

    Satisfied Customers:

    590
    11 yrs of programming (PHP, WordPress, XSL, SQL, JavaScript)