Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Those must be written in java Practice Problem B: The Game of Cubes Source file: cube.(e | cpp l java) Input file: cube.in Read from

Those must be written in java

image text in transcribedimage text in transcribedimage text in transcribed

Practice Problem B: The Game of Cubes Source file: cube.(e | cpp l java) Input file: cube.in Read from a file the size of a cube. Assume the cube centre is at the origin (0,0,0 Read a point on the x,y,z 3-dimension and specify whether this point is inside the cube, on the surface of the cube or outside the cube Input Your program l be tested on one or more test cases. Each test case is specified on 2 lines. The first lne of each test case has the size of the cube side (a float), and the second line of each test case has an x,y,z co-ordinates (3 floats). The last case is followed by a ne with a zero Output For each test case, your program should print a single line of the form: where k is the test case number followed by a single space followed by j which is one of the 3 words surface, inside, outside Sample Input Sample Output 1 outside 2 outside 3 surface 4 inside 18 3/3 ractice Problem A redictive Text Input Source file: predictc cpp java) Input file predict.in Smart mobile devices have dramatically changed the way we interact with machines. One of the smart activities of the smart software in those devices is the ability to predict the word that we are going to type. For example, as I just typed only two letters "mo", the smart software suggested the words "mobile", "mother", and "motion" In fact, "mobile" is the word that I was going to type In this problem, you are asked to mimic the smart device by writing the smart predictive text software. Whenever the user types a word or a part of a word, the program will suggest the top three most frequent words from a dictionary of words such that the typed word is a prefix of the dictionary word. Prefix of a word is defined as "A substring of the word obtained by removing zero or more contiguous letters from the end of the word" For example, h, he, hel, hell, and hello all are prefixes of hello. However, hello is not a prefix of hell because hello is not a substring of hell. Also, ell is not a prefix of hello because the letters removed (h and o) are not contiguous in hello and llo is also not a prefix ofhello because although the letters removed (h and e) are contiguous, they are not at the end of the word. The input may contain several test cases. Each test case contains two parts: a dictionary and a set of queries. The dictionary starts with an integer N (0 the frequency of the second word> the frequency of the third word, and so on. Therefore, the last word in the dictionary has the lowest frequency, and the first word has the highest frequency. A word in dic tionary will be listed exactly once The query part wll contain one word per line and each word shall have at least and at most 10 small letters (a-z'). The query part will end with a line containing only the word ..###" The input will be terminated with the value of N 0. Output For each query word Q, you are to output one line. First you should output the query word 0 followed by a colon and a space and then the top three words, W1, W2, W3, separated by exactly one space. W1 is the highest frequency word in the dictionary such that Q is a prefix of W1. Then W2 is the next highest frequency word having Q as a prefix and W3 is the next highest frequency word having Q has a prefix. In case there are only two words in the dictionary that have Q as prefix you should output those two words. If there is only one word in the dictionary having Q has prefix you should output only that word. If there is no word in the dictionary that has Q as prefix, then you 1/3 should output the query word itself. Sample Input Output for Sample Input 34 g: gulf good gold i: is it i com: competition come company pr: programming prize gol: gold sing: sing gulf programming competition is my Eavorite it the best held every year i come here good luck this world finals first prize gold medal and then gala medal important company sponsors commends all winners am: american d: dubai X: X com pr gol sing american university dubai am 2/3

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

Step: 3

blur-text-image

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

Database Modeling And Design

Authors: Toby J. Teorey, Sam S. Lightstone, Tom Nadeau, H.V. Jagadish

5th Edition

0123820200, 978-0123820204

More Books

Students also viewed these Databases questions

Question

What is one of the skills required for independent learning?Explain

Answered: 1 week ago