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

  Economics assignment

This document contains various important questions and their appropriate answers in the subject field of Economics.

  Demand and supply curves

Economics is the study of the principles governing the allocation of scarce means among competing ends when the objective of the allocation is to maximize the attainment of the ends.

  Long-run perfectly competitive equilibrium for the firm

Evaluate Government intervene and correct this situation?(a) Explain the concept of a concentration ratio. A rise in the price of magarine Explain the impact of external costs and external benefits on resource allocation long-run perfectly c..

  Supply and demand diagrams

Explain each of the following using supply and demand diagrams,  With the use of a graph, explain how these two programs affect cigarette consumption and the price of cigarettes.

  Case study: fisher-price toys

The case study of the Fisher-Price Toys, Inc., a popular case in basic economics and management from the prestigious Harvard Business School.

  Draw the production possibility curve

Draw the production possibility curve and a. Define consumer surplus and producer surplus.

  Tax revenue

The Australian government administers two programs that affect the market for cigarettes

  Maximize total welfare

How many tickets to sell to maximize total welfare.

  Difference between the cv and the ev

The change in consumer surplus (?CS) is not "theoretically" justifiable like the CV and EV but it continues to be the most widely used measure of consumer welfare change. Explain how this can be reconciled

  Depict von neumann-morgenstern utility index u in a diagram

Depict the von Neumann-Morgenstern utility index u in a diagram

  What is the market solution

What is the market solution (market price and quantity) and What is the total surplus of the society under the market solution

  Calculate gross national product and net national product

Calculate gross national product and net national product

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