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

  A production possibilities curve is bowed out

A production possibilities curve is “bowed out,” or concave to the origin, because of:

  Explain and demonstrate using the elasticity formula

Suppose that a 10% decrease in the price of a product has resulted in a 30% increase in the quantity demanded for a product. Is demand elastic or inelastic in this price range? Explain and demonstrate using the elasticity formula.

  Positive economic profit is to sell differentiated products

In perfect competition, economic profit is driven to zero as more firms join the market bidding prices down. One way for firms to maintain positive economic profit is to sell differentiated products. What sort of characteristics might a company empha..

  What is the implied income elasticity of demand for movies

he or she rents 63 movies per year at the same price per movie. What is the implied income elasticity of demand for movies? Are movies a normal good or an inferior good?

  Sexual activity during adolescence-potential consequences

What are some of the risk factors associated with sexual activity during adolescence and potential consequences? What are some of the community-based programs that provide services to address premarital sex in adolescence? In your opinion, are these ..

  Underemployment and excessive current account deficit

U.S. is currently suffering from underemployment and excessive current account deficit. What measures can U.S. take to move away from its present situation towards internal and external balance? Consider rules of Bretton Woods and policy tools.

  Therefore shift the aggregate supply curve to the left

Which one of the following would increase per-unit production cost and therefore shift the aggregate supply curve to the left?

  Consumer spends her income on lobster and frozen pizza

Suppose a consumer spends her income on lobster and frozen pizza. Assume that the consumer has an income of $600, the price of lobster is $50, and the price of frozen pizza is $6. Using indifference curves and budget constraints show the income and s..

  In the specific factors model predict

In the specific factors model predict who seeks protection against trade and who does not. Explain your answer. How does your answer change in the Hecksher-Ohlin model? Explain

  Raise government spending

How much should it raise government spending, if the government looks to raise income to 3000.

  Why are some old eu members so upset about east european tax

these cuts are not discriminate theory, re is nothing EU can or should do about m. So why are some old EU members so upset about East European taxes.

  Amount that the economy is capable of producing

Whenever the amount of output produced is not as great as the amount that the economy is capable of producing, there is a positive GDP ___________ and cyclical unemployment will be the result.

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