Computer Science, asked by sprg6230, 9 months ago

A method specialPrint has been defined. It takes as input an integer and prints each of the digits in word format.Example: for input specialPrint(62), it prints: six twoWrite a program that uses specialPrintto print the values for 37, 93, 14 and 568.Write only the main method. The Mainclass has already been defined

Answers

Answered by athiyashaik136
6

Answer:

public static void main(String[]args){

specialPrint(37);

specialPrint(93);

specialPrint(14);

specialPrint(568);

}

Answered by Rameshjangid
0

Answer:- The main method of special print is as follows:-

public static void main(String[ ]args)

{

    specialPrint(37);

    specialPrint(93);

    specialPrint(14);

    specialPrint(568);

}

Hope this will help too. The algorithm to input a number and then print it in words is given below:-

// C++ implementation of the above approach

#include "bits/stdc++.h"

using namespace std;

// Function to return the word

// of the corresponding digit

void printValue(char digit)

{

   // Switch block to check for the every given digit

   switch (digit) {

   // For digit 0

   case '0':

       count << "Zero ";

       break;

   // For digit 1

   case '1':

       count << "One ";

       break;

   // For digit 2

   case '2':

       count << "Two ";

       break;

   // For digit 3

   case '3':

       count << "Three ";

       break;

   // For digit 4

   case '4':

       count << "Four ";

       break;

   // For digit 5

   case '5':

       count << "Five ";

       break;

   // For digit 6

   case '6':

       count << "Six ";

       break;

   // For digit 7

   case '7':

       count << "Seven ";

       break;

   // For digit 8

   case '8':

       count << "Eight ";

       break;

   // For digit 9

   case '9':

       count << "Nine ";

       break;

   }

}

// Function to iterate through every

// digit in the given number

void printWord(string N)

{

   int i, length = N.length();

   // Finding each digit of the number

   for (i = 0; i < length; i++) {

       // Print the digit in words

       printValue(N[i]);

   }

}

// Driver code

int main()

{

   string N = "123";

   printWord(N);

   return 0;

}

To know more about the given topic above please go through the following

Link1:- https://brainly.in/question/17372277?

Link2:- https://brainly.in/question/5719335?

#SPJ2

Similar questions