Write an algorithm to decide which is cheaper car or bus

Assignment Help Basic Computer Science
Reference no: EM131081719

3.1 Write an Algorithm to decide which is cheaper car or bus for a travel:

You want to decide whether you should drive your car to work or take the bus. You know the one-way distance from your home to your place of work, and the fuel efficiency of your car (in miles per gallon). You also know the one-way price of a train ticket. You assume the cost of gas at $4 per gallon, and car maintenance at 5 cents per mile. Write an algorithm to decide which commute is cheaper.

3.2 Use string concatenation only to complete the following program so that it prints the message "the quick white tiger jumps over the small dog".
public class ConcatDemo
{
public static void main(String[] args)
{
String animal1 = "quick white tiger"; String animal2 = "small dog";
String article = "the"; String action = "jumps over";
/* Your work goes here */
System.out.println(message);
}
}

3.3 Find the output of the following code when the user enters 100 and when the user enters AQ:
public static void main(String[] args)
{
Scanner in = new Scanner(System.in); System.out.print("Enter somthing: "); String str = in.next();
int count = Integer.parseInt(str); System.out.println("Input is " + count);
}

Reference no: EM131081719

Questions Cloud

What is the implied annual interest rate inherent : Red Buckle Inns plans to issue $85,000,000 of 20-year semi-annual bonds in January to help finance an expansion including 120 new hotels. What is the implied annual interest rate inherent in the futures contract? If interest rates increased by 1.5 pe..
Marginal cost of producing a pizza : 1.) Suppose Bob owns a pizza place in a competitive market. If an additional worker will cost Bob $200 and offers marginal productivity of 40 pizzas, what is the marginal cost of producing a pizza? Show your work and explain your reasoning.
Current and projected unemployment for apple : Describe the current and projected unemployment for Apple Inc. over the next five years. 150 words, if source is used please cite.
What would the risk-free rate have to be for the two stocks : Stock Y has a beta of 1.35 and an expected return of 15.3 percent. Stock Z has a beta of 0.8 and an expected return of 11.2 percent. Required: What would the risk-free rate have to be for the two stocks to be correctly priced relative to each other?
Write an algorithm to decide which is cheaper car or bus : Write an Algorithm to decide which is cheaper car or bus for a travel
Price elasticity of demand and total revenue : According to the law of demand, if price increases, quantity demanded of a good or service will decrease or vice versa. Price elasticity of demand tells us how much quantity demanded will decrease when price increases or how much the quantity dema..
What is the expected return of the three-stock portfolio : Currently, the risk-free return is 3 percent, and the expected market rate of return is 9 percent. What is the expected return of the following three-stock portfolio? Wh
Sizeable portfolio of long-term debt in its balance sheet : USB Manufacturing Inc. carries a sizeable portfolio of long-term debt in its balance sheet. The company expects increased volatility in long term interest rates and is concerned about its equity exposure to interest rate risk. Show your calculation. ..
What recommendations would you make to change it : Expatriates frequently complain that when they accept an international assignment, they put their careers on hold while their peers in the home office continue to climb the corporate ladder. To what would you attribute this perception? What reco..

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Implement a program using function for a defined task

Implement a program using function for a defined task. Initial data is read from a file and added from keyboard. Program has to output resulting and initial data.

  Specify the method is leaf

If is Leaf were not a method of a class of binary trees, would a client of the class be able to implement is Leaf ? Explain.

  T & corporate transformation course assignment

T & Corporate transformation course assignment:

  Find a regular expression for the language

Find a regular expression for the language over {a,b} that consists of all strings containing exactly one occurrence of substring ab.

  Application patch management

Application Patch Management Select three applications (not operating systems) that you frequently use. How does each of them address patch management? Visit their Web sites to determine facilities they have to alert users to new vulnerabilities.

  A software system composed of a crawler

A software system composed of a crawler and a query processor that helps users locate specific information on the Web or on a specific Web site

  Analyze the recent

U.S. > Analyze the recent (since Summer '14) decrease in the price of oil. How has supply and demand affected the price of oil today? Looking at the demand and supply determinants, what will most likely happen to the price by mid this year?

  Assignment related to marketing plan

Question 1: Identify the target market and your secondary market for your company.  Question 2: Describe your unique selling proposition (USP). Explain the key factors that make your company different than competitors within your industry.

  Compare and contrast virtual teams and traditional teams

Compare and contrast virtual teams and traditional teams

  Use of basic and advanced sql queries

This laboratory provides practice in the creation and use of basic and advanced SQL queries involving one table in a DB schema.

  When accessing the remote linux machine

When accessing the remote Linux machine

  What will its internal routing structure have to look like

Suppose the large organization now changes its addressing to separate geographical addresses for each office. What will its internal routing structure have to look like if internal traffic is still to be routed internally?

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