Write a program that converts date formats

Assignment Help JAVA Programming
Reference no: EM13339998

Problem 1.1
Write a program that prompts the user to input the length and breadth of a rectangle and then print the rectangle's area?

Problem 1.2 (Programming Exercises (Chapter 3, Exercise 3 pp-165))

The manager of a football stadium wants you to write a program that calculates the total ticket sales after each game. There are four types of tickets-box, sideline, premium, and general admission. After each game, the data is stored in a file in the following form:
ticketPrice numberOfTicketSold
.......
Sample data are shown below:
250 5750
100 28000
50 35750
25 18750

The first line indicates that the box ticket price is $250 and 5750 tickets were sold at that price. Please type above information into a text file and write a program to read those data and output the number of tickets sold and the total sale amount on the screen.

Problem 1.3

Write a program that converts date formats from American Format: "September 4, 2013" to International Format; - such as "2013 September-4".

Hint: you may use several string methods, including:

• str.indexOf(c): given a string str and a character c, this finds the position (starting at 0) of the first instance of c in str.
• str.substring(p): given a string str and a position p, this method returns a new string starting at position p and going until the end of the string.

You can solve this problem in the follow way. You should first look for everything that comes before the first space. This will be the month. Save this in a String variable, and then use substring to find everything that comes after this point -the remainder of the string. Working from this remainder, you can search for the comma (using indexOf) to find the piece that has the date. Once you have this, everything after the comma is the year. You can then using string concatenation (with the + operator) to tie the year, month and date together like "2008-January-30".

Problem 1.4

Write a program that prompts the user to input an integer between 0 and 35. If the number is less than or equal to 9, the program should output the number; otherwise, it should output A for 10, B for 11, C for 12,..., Z for 35. (Hint: use the case operator (char)(number+55)).

Reference no: EM13339998

Questions Cloud

Draw a graph to illustrate the shape of a typical indifferen : The consumer has an income of $24 per week. The price of a hamburger is $2 and the price of a milkshake is $1. How many milkshakes and hamburgers will he buy each week if he maximizes utility? Illustrate your answer on a graph.
Identify the competitive advantages of some market leaders : Identify the competitive advantages of some market leaders such as Sony. Are these country-specific or firm-specific advantages?Answer the above in 300-350 word essay format with at least two cited references as per APA 6th Ed. format.
What is the magnitude of the average current in the region : Suppose that a particle accelerator is used to move two beams of particles in opposite directions. In a particular region, electrons move to the right at 9350 m/s and protons move to the left at 1.230 × 103 m/s.
Calculate how long is the plane : A 3.9- cm-radius ball rolls down an inclined plane from rest at the top. How long is the plane
Write a program that converts date formats : Write a program that prompts the user to input an integer between 0 and 35. If the number is less than or equal to 9, the program should output the number; otherwise, it should output A for 10, B for 11, C for 12,..., Z for 35. (Hint: use the case..
Find the gauge pressure in the pipe on the top floor : Water at a gauge pressure of P = 3.4 atm at street level flows into an office building at a speed of 0.90m/s through a pipe 5.6 cm in diameter. find the gauge pressure in the pipe on the top floor
What would be the effect of this investment on u.s. gdp : What would be the effect of this investment on U.S. GDP? Would the effect on U.S. GNP be larger or smaller?
What is a business model : What is a business model? How does it differ from a business plan?
Estimate the fixed cost and variable cost : Using least-squares regression, estimate the fixed cost and variable cost elements of monthly car wash costs.

Reviews

Write a Review

 

JAVA Programming Questions & Answers

  Robot preparing for competition

Create an event so that the skateboard can be controlled by game player

  Write a program that prompts for and accepts input of test

write a program that prompts for and accepts input of test ggrades that are integers between 0 and 100. For each numerical test grade,  program should display a corresponding letter grade

  Create a class safestack that implements a stack of strings

Create a class SafeStack that implements a stack of strings

  Chat monitoring system

The name of the project is chat monitoring system. in the file you will see the screenshot diagram 2A are my design, i want it to be upgrade, to look professional like the diagram 2B. please java, netbeans and GUI. please can I have only the client s..

  Modeling the caves

Assignment 2 Description:  You are a mighty warrior, and armed with your trusty bow and 3 arrows, you enter The Caves in search of the mighty Wumpus. If you shoot the Wumpus, you are victorious and the masses will praise you, but if you stumble upon ..

  A program that reads in two integers typed on the keyboard

Write a program that reads in two integers typed on the keyboard and outputs their sum, difference, and product. Must compile correctly in Eclipse. Here is what I have done, but its wrong.

  Returns the object with the largest measure

public static Measurable maximum(Measurable[] objects)that returns the object with the largest measure. Use that method to determine the country with the largest area from an array of

  Give at least one constructor without any parameter

We learned as popular Set implementation. Write own TreeSet class that implements following interface: You are to give at least one constructor without any parameter.

  String as its parameter and returns the length

Write a method named longestWord that accepts a String as its parameter and returns the length of the longest word in the string.A word is a sequence of one or more non-space characters (any character other than the space character).

  Accepts a scanner representing an input file

Write a method in JAVA called stripHtmlTags that accepts a Scanner representing an input file containing an HTML web page as its parameter, then reads that file and prints the file's text with all HTML tags removed. A tag is any text between the c..

  Elements from a html document

Function test Count List Elements should simply retrieve an array of all list elements on the page and assert that their total count is 3.

  An elementary calculation yields the result

An elementary calculation yields the result that theoretically, the probability of turning up 7 when two dice are thrown is 1/6, or .166666. But what if more dice are thrown? If 3 dice are thrown, what is the probability that some 2 of three sum to 7..

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