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

  Dee fektiv is concerned that too many forms

Dee Fektiv is concerned that too many forms are being filled out incorrectly. She feels that about 10 percent of forms have an error. a. How large a sample size should Dee use to be 99% certain that she will be within 0.02?

  Evaluate the condition number of a symmetric matrix

How can you evaluate the condition number of a symmetric matrix; and how does this number relate to its numerical conditioning properties?

  Show by induction

Show by induction that n^5- n is divisible by 5 for all n ? 0.

  Create a java gui business application

Create a Java GUI business application. This program may be any business application of your choice.

  A static structure mechanical system

How do you construct a 3D degenerate model on A static structure mechanical system

  How cultural values affect moral legitimacy

Identify examples of how cultural values affect moral legitimacy

  Why is it important to have a body of standard job

Why is it important to have a body of standard job descriptions for hiing information security professionals?

  Compare and contrast the dyb and gyb strategies

Write clearly and concisely about enterprise architecture topics using proper writing mechanics and technical style conventions.

  Develop a plan to connect your remote users

Develop a plan to connect your remote users. your solution can involve more than one remote access type.

  Business environment impacted development telecommunication

Describe in scholarly detail how business environment has influenced development of telecommunications technology.

  Why organizations important to continual learning

Why are professional organizations important to continual learning? What professional organizations benefit both the employee and the employer

  Explain the difference between an object reference in java

Explain the difference between an object reference in Java and an object. Use an example to illustrate your answer.

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