Write a mars program that can perform conversions

Assignment Help Other Subject
Reference no: EM132084391

Number Converter:

Write a MARS program that can perform conversions between binary, decimal, and hexadecimal representations for positive integers (under 32 bits).

Your program should accept a string that follows the following format -- invalid inputs or formats should be rejected.

Format: , where the input and output types can be one of "b", "d", "h". Hex inputs will start with 0x and use lower case letters.

You should then print the converted answer and prompt the user again (unless the user enters a string starting with e).

Here is an example run of this program:

What would you like to convert?
d b 33
100001
What would you like to convert?
b h 100010
0x22
What would you like to convert?
h d 0x23
35
What would you like to convert?
d b 4b
Sorry, invalid format.
What would you like to convert?
f g 43
Sorry, invalid format.
What would you like to convert?
e

Reference no: EM132084391

Questions Cloud

Centralized organization structure-decentralized one : What are the advantages of a centralized organization structure vs. a decentralized one? What are the disadvantages?
Current price of mummeball common stock : If the required rate of return on this stock (ks) is 12%, what is the current price of Mummeball's common stock?
How many positive 4-digit elegant numbers exist : How many positive 4-digit elegant numbers exist? Some numbers to include are 1345, 5999, 6554, and 7828.
Should i accept or reject the project : Accept or reject decision base? rejected the return is less than risk based or accept the return is greater thank risk based?
Write a mars program that can perform conversions : Write a MARS program that can perform conversions between binary, decimal, and hexadecimal representations for positive integers (under 32 bits).
What earnings before interest and tax : What earnings before interest and tax (EBIT) must the firm have if it were to provide $1 per share to the shareholders? Assume perfect markets.
How to convert the ebit to free cash flow : How to convert the EBIT to free cash flow for the next 12 years?
Cash flow of the loan from the borrower perspective : Calculate (a) The cash flow of the loan from the borrower's perspective (b) The amount of the annual principal repayment (c) The stream of interest payments
Create a simple number guessing game : Create a simple number guessing game. Before the game starts, your program will randomly select a number between one and ten.

Reviews

Write a Review

Other Subject Questions & Answers

  Distinguish between fixed budgets and flexible budgets

Distinguish between fixed budgets and flexible budgets. When are each an appropriate means of evaluating a manager’s performance and why?

  What are prototyping’s advantages and disadvantages

Why has prototyping become a popular way to develop business applications? What are prototyping’s advantages and disadvantages?

  Complete the mental state examination

Complete the mental state examination

  Current role in the regulation of cam

Examine the government's present role in the regulation of CAM and make recommendations, with rationale, on what role the government must take.

  Brief history of manufacturing in greenville south carolina

Brief history of manufacturing in Greenville, South Carolina? For any given product that it presently manufactures in Greenville, at what point might Standard Motor Products stop manufacturing in Greenville and import from overseas

  Identify the part of setting up a simulation in excel

Identify the part of setting up a simulation in Excel that you find to be the most challenging, and explain why. Identify resources that can help you with that.

  Shortcoming of disaster relief efforts

A common shortcoming of disaster relief efforts is that they:

  Define anthropometric

Define anthropometric and do you know what conditions, hungry or eating, are insulin and glucagon produced? and what organ produces insulin and glucagon ? do you know what dairy foods are better for lactose intolerant individuals? and adoes a mono sa..

  Write essay on government role in hospital growth or decline

Write an essay on Government Role in Hospital Growth and Decline. Submit a paper that explains the government role in hospital growth.

  Explain what could have contributed to the given diagnosis

Based on your readings and research so far, explain what could have contributed to this diagnosis? Provide in-text citation(s) to support your explanation.

  With the rise of corporate social initiatives

With the rise of Corporate Social initiatives (e.g U.N Global Compact), should countries reduce regulations and restrictions on business?

  Start with introduction which includes a list of the topic

literature review is to be submitted.this will consist of developing a comprehensive literature review chapter for the

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd