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

  Organization structure change over time

How and why did the organization structure change over time, and in what ways were some of these changes responsible for some of their recent problems?

  Write an application with three labeled text field

Write an application with three labeled text fields,one each for the initial amount of a savings account, the annual interest rate, and the number of years. Add a button "Calculate" and a read-only text area to display the balance of the savings acco..

  To report the amount of the fine

To report the amount of the fine, which is $25 for the first hour or pan of an hour that the car is illegally parked, plus $10 for every additional hour or part of an hour that the car is illegally parked

  Write a program that reads a list of real numbers.

Write a program that reads a list of real numbers. After the program ends it should print out only the unique numbers

  Problem on java progamming

Which parts of the assignment were you not able to complete fully? For each, explain why you were unable to complete this part and what steps you took to attempt to complete it.

  Define get and set functions and two constructors

Create a class called Building. It will have one data member of type string (used for a postal address). Define get and set functions and two constructors.

  E-marketing-e-commerce consultant

You are an e-marketing and e-commerce consultant. Mary and Joe Johnson, the owners of Book Bunker, have hired you to help them improve their sales both online and in their store.

  Negatively impacting health care currently

Identify and explain at least two events that are negatively impacting health care currently. Tell us why you think these items are negatively impacting the access to care, and make sure that you cite your references.

  Write an application that uses string method region

Write an application that uses String method region - Matches to compare two strings input by the user. The application should input the number of characters to be compared and the starting index of the comparison.

  Create a class in java to enable its object to be persiste

How do you create a class in Java to enable its object to be persistent? What are Java data streams and how are they used to facilitate storage and retrieval of persistent objects?

  Computing the time complexity using the big-o notation

You are required to calculate the time complexity using the big-O notation of the Algorithm_2 given by the following methods defined by the following Java code.

  How large a value can be stored in an integer variable

Most programming languages have a built-in integer data type. Normally this representation has a fixed size, thus placing a limit on how large a value can be stored in an integer variable

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