Exercise-formatting java files

Assignment Help Business Economics
Reference no: EM131439306

Exercise: Formatting Java files

Write a program that prompts the user for a file name, assuming that the file contains a Java program. Your program should read the file and print its contents properly indented. When you see a left-brace character { in the file, increase your indent level by four spaces. When you see a right-brace character } , decrease your indent by four spaces. You may assume that the file has only one opening or closing brace per line, that every block statement (such as if, for, etc.) uses braces rather than omitting them, and that every relevant occurrence of a { or } character in the file occurs at the end of a line. Consider using a class constant for the number of spaces to indent (4) so that it can be easily changed.

  • You may start with theFormatJavaProgramprovided.
  • CHALLENGE: Don't use the providedFormatJavaProgram, which provides the logic for deciding when to indent. Instead, start your program from scratch, and try to write the logic yourself!
  • Output the newly formatted file as a new Java file called <ProgramName>_Formatted.java. It will be up to the user to change the name appropriately for compilation later.
  • CHALLENGE 2: Save the formatted code to the same file that you read itfrom!
  • Use boilerplate code from program we developed today!
  • Usean "ugly" version of theHoursWorkedprogram we developed in class today as input to yourFormatJavaProgramprogram.
  • Makesure you comment your code well!

Reference no: EM131439306

Questions Cloud

Acceptance of new or replacement technology : The technology acceptance model (TAM) is a two-factor model that describes user acceptance of new or replacement technology solutions (Davis, 1989). This evaluation model has withstood the test of time and is widely used. The model is based upon p..
Homicide detective investigates the claims of the gospels : Read Cold-Case Christianity: A Homicide Detective Investigates the Claims of the Gospels. When you reading it, write a quick review for it in word document
Review the enron case information presented : LDR-800: Review the Enron case information presented in the textbook. If you were a high-level leader in this corporation, how might applying your personal ethics have changed the outcome?
Explain why character matters in our modern world : Explain why character matters in our modern world.Using your understanding of Greek moral thought, explain why virtue is so important. Explain how the theorists after the Greeks viewed moral character. Pick two philosophers.
Exercise-formatting java files : Write a program that prompts the user for a file name, assuming that the file contains a Java program. Your program should read the file and print its contents properly indented. When you see a left-brace character
What happens when perception and reality are not congruent : LDR-800: If I am perceived to be an ethical leader, am I an ethical leader? Why or why not? What happens when perception and reality are not congruent?
Describe the potential pitfalls you envision : Describe the potential pitfalls you envision in trying to execute this plan. Explain which data elements you think will be most challenging to capture, and why.
How are ethics and leadership related : LDR-800: Discussion Question- How are ethics and leadership related? Can a toxic leader be an ethical leader? Why or why not?
Evaluate the web site structure and documentation : Describe what if any changes you would recommend in the web site structure and organization and content. What is the URL and web site name?

Reviews

Write a Review

Business Economics Questions & Answers

  Proximate cause of this depreciation is actions

The euro has been depreciating against the $ for the past several months. The proximate cause of this depreciation is actions taken by the European Central Bank (ECB). What were those actions? Why did the ECB take those actions?

  Full employment-GDP deflator

Country X has an $8000 billion GDP and a population of 200 million. Country Y has a $6000 billion GDP and a population of 150 million. Which of the following is true? Full employment is: If the GDP deflator is now 125, we may conclude that since the ..

  Q1 suppose you have 7000 in savings when the price index is

q1. suppose you have 7000 in savings when the price index is at 100. if inflation pushes the price level up 10 what

  Equivalent to the series of maintenance costs

Costs for maintaining buildings at an industrial complex over a 13-year period are expected to be $3,932 in year 1, increasing at the rate of 15% per year through year 13. At an interest rate of 15% per year, what present worth (at time 0) is equival..

  Time spent working and time spent shirking

Describe how a manager who derives satisfaction from both income and shirking allocates a 10-hour day between these activities when paid an annual, fixed salary of $130,000. Time spent working: Time spent shirking:

  Expand his shop in that way allowing more customers

Expand his shop in that way allowing more customers to be served on a Saturday morning?

  Maintain the same profit

If the company will sell the number of units obtained in part d and wants to maintain the same profit as last year, what will its new price have to be.

  About half of the paid lobbyists

About half of the paid lobbyists in Washington are former government staff members or former members of Congress. Why would interest groups employ such people? Why might some reformers want to limit the ability of interest groups to employ them?

  Furniture maker estimates his learning curve

A furniture maker has an order for 94 identical tables. If the furniture maker estimates his learning curve at 87% and can reach steady production of 7 hours per table on the 7th table, how long should it take to make all the tables? Express your ans..

  Diagnostic testing facilities tend to order more tests

Physicians who own their own diagnostic testing facilities tend to order more tests, charge higher fees for them, and have higher total bills to patients.

  Repay the entire principal in addition to interest payment

borrow 1000 at t=0. Make exact interest only payments at the end of each year for 4 years and at the end of the 4th year repay the entire principal in addition to the last interest payment. borrow 10000 at t=0. Pay a principal payment each year of 25..

  Does the existence of efficiency loss

Does the existence of “efficiency loss” associated with health care over-consumption mean that citizens are worse off with the government’s provision of this insurance?

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