1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Nastasia [14]
4 years ago
8

Checker for integer string (Please answer in C++):

Computers and Technology
1 answer:
MaRussiya [10]4 years ago
4 0

Answer:

import java.util.Scanner;

public class LabProgram {

   public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

       String num = in.nextLine();

       boolean allDigits = true;

       for (int i = 0; i < num.length(); i++) {

           if (!Character.isDigit(num.charAt(i))) {

               allDigits = false;

           }

       }

       if (allDigits) {

           System.out.println("yes");

       } else {

           System.out.println("no");

       }

   }

}

Explanation:

Output: 1995

             Yes

             Process finished with exit code 0

You might be interested in
What is an end user license (EULA) agreement an example of?
sattari [20]

Answer: a retailer

Explanation:

3 0
3 years ago
Read 2 more answers
Write a program that prompts the user to enter the minutes (e.g., 1 billion), and displays the number of years and days for the
konstantin123 [22]

Answer:

// here is code in c++.

// include headers

#include <bits/stdc++.h>

using namespace std;

// main function

int main()

{

// variables

long long int minutes,years,days;

long long int s;

cout<<"please enter the minutes:";

 // read the minutes

cin>>minutes;

 // make a copy

s=minutes;

 // calculate days

days=minutes/1440;

 // calculate years

years=days/365;

 // calculate remaining days after years

days=days%365;

// print the result

cout<<s<<" minutes is equal to "<<years<<" years "<<days<<" days."<<endl;

return 0;

}

Explanation:

Read the number of minutes from user and assign it to variable "minutes" of long long int type.Make a copy of input minutes.Then calculate total days by dividing the input minutes with 1440, because there is 1440 minutes in a day.Then find the year by dividing days with 365.Then find the remaining days and print the output.

Output:

please enter the minutes:1000000000                                                                                                                          

1000000000 minutes is equal to 1902 years 214 days.

4 0
3 years ago
Organizations are struggling to reduce and right-size their information foot-print, using data governance techniques like data c
natka813 [3]

The effort is necessary in making sure that the data is meaningful, correct, and timely. Many analysts are increasingly focused on quality on a per-attribute basis instead of a per-report basis. This will avoid excess control of access and instead focus on meaning. A data-driven organization that includes a comprehensive data cleanup is able to make informed choices that maximize value on strategic investments.

8 0
3 years ago
Write a program to prompt the user for a positive integer: N. The program will repeatedly divide the input in half using a loop,
a_sh-v [17]

Answer:

using python to write the program

Explanation:

#To use the log function, the module must be imported

import math

n=int(input("Enter number to be halved"))

count=0

while(n>1):

   count=count+1

   n=n//2

print("The number halved is now ", n, "The is the ", count, "iteration")

x = math,log(2,(n))

print("The log of n is:", x)

5 0
3 years ago
Write a recursive function, displayFiles, that expects a pathname as an argument. The path name can be either the name of a file
timama [110]

Answer:

Here is the Python function:

import os   #module used to interact with operating system

def displayFiles(pathname):  #recursive function that takes a pathname as argument

  if (os.path.isdir(pathname)):  #checks if specified path (argument) is an existing directory

      for content in os.listdir(pathname):  #gets the list of all files and directories in the directory and iterates through the items of this list of directory

          contents = os.path.join(pathname, content)  #joins contents of path

          displayFiles(contents)  #calls function recursively

  else:  #if pathname refers to a file

      filename=pathname  #sets filename to pathname

      file = os.path.basename(filename)  #gets base name in specified path

      print("File Name: ", file) #displays the name of file

      with open(filename, "r") as contents:  #opens file in read mode

          print("Content:")  #prints Content:

          for lines in contents:  #iterates through the contents of file

              print(lines)   #displays the contents of file

Explanation:

The recursive function  displayFiles contains a single argument  pathname which can either be a pathname or a filename  . If the given argument is pathname for directory  , then the directory is opened and os.listdir returns a list containing the names of the entries in the directory given by pathname and append these contents in the list. Then this function is called recursively to print each file name and this function is applied to each name in the directory. However if the pathname refers to a file then the pathname is set to filename , the file is opened in read mode and the contents of the file are displayed.

8 0
4 years ago
Other questions:
  • DG Loans, a mortgage lender, was charged with a discrimination lawsuit. It alleged that the company was offering loans at higher
    13·1 answer
  • Select two netiquette guidelines. In a paragraph of no less than 125 words, explain why these guidelines make professional onlin
    9·1 answer
  • Discuss four ways you will use to reach all pupils who are living at a disadvantaged area.
    14·1 answer
  • Indicate the time efficiency classes of the three main operations (i.e., FindMax, DeleteMax, and Insert) of the priority queue i
    11·1 answer
  • You use ddl to create, modify, and delete the ___________________________ of a database.
    6·1 answer
  • The variable most_recent_novel is associated with a dictionary that maps the names of novelists to their most recently published
    12·1 answer
  • Write a shell (text-based) program, called first_word.py, that opens the file stuff.txt and prints out the first word of every l
    14·1 answer
  • Which sentence(s) below are true?a. IP stands for Internet Protocol.b. In most home networks IP addresses are assigned by the In
    6·1 answer
  • How do mass and social media differ
    8·1 answer
  • Which disipline involves creating computer networks
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!