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

  Write java program to display results in java applet

Write down the java program which displays following results in java applet. Permits the user to enter three numbers (use JOptionPane for this) and prints out average of those value on screen.

  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.

  Solve the currently very un-pc cigarette smokers problem

Write solution to solve the currently very un-PC"cigarette smokers problem" in java using Java threads, and monitors (using the "synchronized" keyword) (If it bothers your PC sensibilities, think of it at the Pot-smokers problem and then it is all pr..

  Button to increase or decrease the number of the balls

Simulates a bouncing ball. Extend to allow mulitple balls. You can use the +I or -I button to increase or decrease the number of the balls and use teh Suspend and Resume buttoms to freeze the balls or resume bouncing. For each ball, assign a random c..

  Creates a professorraing class

Write a program that creates a professorRaing class consisting of professor ID and three ratings. The three ratings are used to evaluate easiness, helpfullness, and clarity. In a separate implementation class, allow the user to enter the values.

  Create and code a program that uses three parallel numeric

Create and code a program that uses three parallel numeric arrays of size 6. The program searches one of the arrays and then displays the corresponding values from the other two arrays.

  Create a project in eclipse

Create a new project

  Create a java class called samearraysexception

Create a Java class called SameArraysException that extends the Exception class.

  Enterprise java beans (ejb) in software development

Enterprise Java Beans (EJB) in software development, EJB technology, EJB application, Stateless Session Beans (SLSB), Stateful Session Beans (SFSB), Message Driven Bean (MDB), Entity Bean

  Vehicle in vehicle.java

Create a class called Vehicle in Vehicle.java with instance variables make (such as Ford, GM, Chrysler, Toyota, or Honda), year, and horsepower (200, 300, and 400). Add the necessary constructor and set and get methods.

  Explain calculating average asdouble

EnhancedTestScoreApp.javacompiles, Uses += onscoreCountandscoreTotalfields, UsesMathclass methods to track minimum and maximum scores, Displays minimum and maximum scores at end, ChangedscoreTotaltoint, CastscoreCountandscoreTotaltodoublebefore calcu..

  Find method of the class is passed each of the targets

How many calls to the recFind method of the ArraySortedList3 class are made when the find method of the class is passed each of the targets?

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