Print the converted sentence both to the screen

Assignment Help Computer Engineering
Reference no: EM132137148

String Problem

For each numerical value 0, 1, 2, ...9 (0 <= NUMBER <= 9), embedded in a sentence, convert that value to its equivalent English text.

Print the converted sentence both to the screen and to an output file. Your input file consists of a variable number of records.

Each record is a sentence of length <= 80 characters.

More than one numerical value in the given range may appear in a sentence. You must deal with upper and lower case issues.

If a line begins with a single digit, write that digit as a word starting with an uppercase letter.

See the examples below.

Examples:

Input Record: 3 foxes were chasing 5 rabbits and 10 ducks.

Output Record: Three foxes were chasing five rabbits and 10 ducks.

Input Record: I used 3 eggs out of the 12 for the cake.

Output Record: I used three eggs out of the 12 for the cake.

Input Record: 1 picture is worth 1000 words.

Output Record: One picture is worth 1000 words.

Input Record: There are 260 students enrolled in Java.

Output Record: There are 260 students enrolled in Java.

Create the following as an input file for testing.

The 8 eggs were separated into 3 groups.

5 boys and 7 girls were present.

He was 1 hour and 5 minutes late.

She ate 3 dozen doughnuts!

4 dogs were chasing 3 cats.

The captain said, "This is the 0 hour". I tried to call you 9 times today; Ann tried 6 times!!

The 12 firemen worked quickly.

Prompt the user for the name of the input file. Name your output file "outSentences.txt" . Save the output file in the same directory as your code to make grading on different systems easier.

More details: Create two class files. One class is the Converter.

It has a StringBuilder field for the original sentence and a String field for the converted sentence.

The constructor will call a method to convert the original sentence. You are to use only a select few methods of the StringBuilder class for the conversion.

These are the only methods of the String and StringBuilder class you are permitted to use:

StringBuilder: String: constructors constructors charAt( ) charAt( ) indexOf( ) length( ) length( ) replace( )

You are also permitted the use of the isDigit( ) method from the Character class.

The second class is the driver class

The driver will contain the main( ) method.

The main( ) method will open a file for input.

Read the file line by line and send each line to the Converter class.

The main( ) method will call the get method( ) of the Converter class to get the converted string, and print this string both to the screen and to a file.

Reference no: EM132137148

Questions Cloud

Employer take to minimize possiblity of terminations : What steps can an employer take to minimize the possiblity of terminations being overturned by legal actions? Why?
The risks associated planned procurement approach : Identify the risks associated planned procurement approach. how procurement risks for this project will be monitored and controlled.
Annual holding and setup costs : The soft goods department of a large department store sells 175 units per month of a certain large bath towel. annual holding and setup costs?
What is the complexity of any dynamic programming approach : What is the complexity of any dynamic programming approach based on parts a) and b), assume that s and t are of length a and b. Use Big Omega notation
Print the converted sentence both to the screen : Print the converted sentence both to the screen and to an output file. Your input file consists of a variable number of records.
Develop your own string class : Develop and work with a C++ class, define constructors and destructors, define member functions outside .
Which of the following statements will display a string : Which of the following statements will display a string as "Jones, Jane" (the last name, a comma, a space, and the first name) in the lblFullName control?
Write a method with an input variable : Write a method with an input variable (string type). The method should return the number of uppercase letters of the input variable.
Write a query that satisfies the given requirements : Write a query that satisfies the given requirements by making sure to use GROUP BY and HAVING clauses.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Draw the logic diagram for a circuit

Draw the Logic diagram for a circuit that resolves priority among eight active-low inputs, 10_L-17_L, where 10_L has the highest priority.

  Discuss usermod command is used to change a linux user

Discuss a specific parameter you would used with the usermod and what you need to consider either

  Write code that produces 10 dashes of length

Write code that produces 10 dashes of length (and gap) 20. Define a fuction dashes() that draws multiple dashes and takes 3 parameters.

  How many boolean functions of degree n are self-dual

How many Boolean functions of degree n are self-dual? We define the relation = on the set of Boolean functions of degree n so that F = G.

  How is the height of a red-black tree related to its size

How is the height of a red-black tree related to its size? What is the relationship between red-black trees and B-trees?

  How your team has decided to address the issues

Discuss issues encountered in the work and how your team has decided to address the issues. Prepare a functional prototype of your application.

  What is the average case time complexity for linear search

What is the average case time complexity for linear search on a sorted array? Explain (and/or draw a diagram).

  How does the home agent accomplish this interception

Describe the major difference between a stack and a queue - Using the stack algorithm for computing Post fix expressions, trace the algorithm on the Post fix expression below, showing the stack at the end of each iteration of the loop.

  Problem on sql statement

Problem on  SQL statement

  Discuss the benefits of a forensic readiness plan

Prior to any incident happening, it is important for any company to implement a "forensic readiness" plan. Discuss the benefits of a forensic readiness plan.

  Deduce a set of boundary-layer differential equations

Starting with the general viscous energy equation, show by a succession of steps how and why it reduces to the classic heat-conduction equation for a solid.

  Developing the database of company

Enable the user in order to input a last name; then find the file and show all the names and phone numbers corresponding to that last name.

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