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

  Effects of imposing industry-wide minimum safety standard

Demonstrate and discuss the effects of imposing a new industry-wide minimum safety standard. Under what circumstances might such a minimum safety standard leave at least some workers better off than they were before government intervention?

  One-country model in section suppose

Country described by the one-country model in section Suppose that the country temporarily raises its levels of γA. Draw graphs showing how the time paths

  Deposited the money into the account

Suppose you will receive $100 in six months and have access to an account that earns 1/2% per month. If you deposited the money into the account how much would you have 18 months from now?

  Cross-regional studies of medical practice variations

Cross-regional studies of medical practice variations an comparisons of individual physicians' "styles" show considerable differences between the rates of use of medial care across providers.

  Critique of southwire ethics policy

The Southwire Company is North America's leading manufacturer of wire and cable. Southwire maintains and publishes manuscripts detailing the organizations commitment to ethics. The manuscript can be accessed via the company website and through pri..

  Should you make her an offer at the salary

Should you make her an offer at the salary or continue the interviewing process. Explain

  Net borrower-net lender-gross borrower-gross lender

A country that borrows more from the rest of the world than it lends to it in a year is called a ________, and a country that lends more to the rest of the world than it borrows from it in a year is called a ________.

  What effect do you think this had exchange rate

At prompting of United States, Japan relaxed restrictions and allowed companies to invest anywhere in world. What effect do you think this had on yen/dollar exchange rate and trade balance between two countries.

  Examples of moral hazard

Identify which of the following situations currently faced by the World Bank or the International Monetary Fund are examples of adverse selection and which are examples of moral hazard.

  Most effective company development strategies

Discuss the characteristics of the most effective company development strategies. Which characteristic do you believe is most important? Why?

  Two firms compete in a homogeneous product market

Two firms compete in a homogeneous product market where the inverse demand function is P = 10 -2Q (quantity is measured in millions). Firm 1 has been in business for one year, while Firm 2 just recently entered the market. Each firm has a legal oblig..

  What is her combined incremental tax rate

A woman with a taxable income of about $100,000 has a federal incremental tax rate of 26% and a provincial incremental tax rate of 12.29%. What is her combined incremental tax rate?

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