subject

Write a program that prints all nonempty substrings of a string, in decreasing length, starting with the substrings at the front of the string. for example, if the string is "fred", you print

fred
fre
red
fr
re
ed
f
r
e
d
given:

import java. util. scanner;
public class printallsubstrings
{
/**
prints all non-empty substrings of a given word in decreasing
length, starting with the substrings at the front of the string.
@param word the word whose substrings are to be printed.
*/
public static void printallsubstrings(string word)
{
. .
}

public static void main(string[] args)
{
scanner in = new scanner(system. in);
system. out. print("enter a word: ");
string input = in. next();
printallsubstrings(input);
}
}

ansver
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 21:30, willwhitlock803
Write code using c . (take input from user) calculate the size of a given file in kbs. in this task you will complete the function with the following prototype: float get_file_size(char * filename); the function takes the file name (address to the start of a null terminated character array) as input. the function should then open the file and find the number of bytes it contains till eof. the number of bytes divided by 1024 will give the size in kbs. if the file cannot be opened the function should return -1.
Answers: 2
image
Computers and Technology, 22.06.2019 08:10, Bearboy5957
Ihave a music player on my phone. i can buy songs, add them to playlists and play them. obviously it would be redundant to store each song in each playlist; each playlist is just a list of pointers to the songs. for this lab you will simulate this behavior. your program will need to have options to: add songs to the system library (you will store the text of the first line of the song, rather than the audio) add playlists add songs to a playlist list playlists play a playlist list all of the songs in the library with a count of how many times each song has been played remove a song from a playlist remove a playlist remove a song from the library (and thus from all playlists that contain it) note that we will not be checking many error cases. in real programming this would be bad, you should usually try to recognize and respond to as many types of errors as you can. in the context of class we are trying to acquaint you with as many concepts as possible, so for the sake of educational efficiency we will not be checking most errors in this lab, you may assume that your user provides correct input. you may add all appropriate error testing if you wish, but we will not be testing for it.
Answers: 2
image
Computers and Technology, 22.06.2019 10:30, JeroMii
Think about a recent customer service experience - either positive or negative. write a brief summary of that experience. now think about those four characteristics we look for in customer service representatives. how did the representative in your example stack up? write down your answer and give specific examples.
Answers: 1
image
Computers and Technology, 22.06.2019 19:10, sammigrace5820
How might the success of your campaign be affected if you haven’t carefully completed all field data or if you accidentally insert the wrong merge field in the document?
Answers: 1
You know the right answer?
Write a program that prints all nonempty substrings of a string, in decreasing length, starting with...

Questions in other subjects:

Konu
Mathematics, 05.11.2020 06:50
Konu
English, 05.11.2020 06:50
Konu
Mathematics, 05.11.2020 06:50
Konu
Mathematics, 05.11.2020 06:50