Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

How to modify this program to meets requirements. It needs to print last lines of each paragraph. import java.util.Scanner; /* Name of the class has

How to modify this program to meets requirements. It needs to print last lines of each paragraph.

import java.util.Scanner;

/* Name of the class has to be "Main" only if the class is public. */ class Exercise1 { /** A simple static string for HTML & table header. */ private static final String HTMLHeader = " " + " " + "

" + " CSE-278: Exercise 1 " + " " + " " + " "; /** A simple static string to print HMTL footer. */ private static final String HTMLFooter = "
" + " " + "

public static void main(String[] args) { System.out.println(HTMLHeader); Scanner keyboard = new Scanner(System.in);

while (keyboard.hasNextLine()) { String line = keyboard.nextLine(); System.out.println("

" + line + ""); } System.out.println(HTMLFooter); } }

image text in transcribed

image text in transcribed

Exercise: A paragraph consists of a set of lines of text separated by one-or-more empty lines (i.e., empty strings, see java.lang.String.isEmpty method). You are expected to modify the supplied Exercisel.java to print just the last lines of each paragraph in HTML format ( use exactly the same format already setup f or you) Sample input and output (additional tests cases will be run by in Canvas CODE plug-in) Note: Inputs and outputs are shown separately below to ease copy-pasting inputs. In practice, inputs and outputs will appear intermixed on your console and that is just fine Sample input (blank lines intentional. See paral.txt): para #1 welcome para #2: Intr ducti n This is a simple test line to create a2line para conclusion of inputs This para is the last para. It has 3 line 3 lines including this one and 3 blank lines at end Last paragraph with 1 line Expected output: CSE-278: Exercise 1 kbody lines at end
welcome.
t create a 2 line para
3 line s including this one and 3 blank Last paragraph with 1 line

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Databases Object Oriented Deductive Hypermedia Technologies

Authors: Kamran Parsaye, Mark Chignell, Setrag Khoshafian, Harry Wong

1st Edition

0471503452, 978-0471503453

More Books

Students also viewed these Databases questions

Question

What is carpal tunnel syndrome?

Answered: 1 week ago