2. Write a program that constructs a random telephone number of the form (XXX) xXX-XXXX and outputs a formatted string (parentheses and dashes included) according to the following rules: a. The first 3 digits may not contain an 8 or 9. b. The second set of three digits must be larger than 100 and less than 888. You must construct the desired string (using Random class) and then output it accordingly. Until you are confident in your code, seed the random number generator with 0. For example, (777)-101-0000 is a valid number.
Q: Write a program that gets 2 string variables and 2 integer variables from the user, concatenates…
A: As no programming language is mentioned it is solved using C++
Q: Consider the following program with a missing statement that calls the split string method. line =…
A: line = "TSLA, 3-10-2022, $830.12"ticker,date,price = line.split(",")print (ticker, price)
Q: Write a python program that takes input values as integer, checks the number is not less than 10…
A: Given: Create another class ‘Intern’ and inherit ‘Employee’ as super class. Concatenate the integer…
Q: Write a program that reads students’ names followed by their test scores. The program should output…
A:
Q: What is the output produced by the following code? int *p1, *p2; p1 = new int; p2 = new int; *p1 =…
A: #include <iostream>using namespace std;int main(){ int *p1, *p2;p1 = new int;p2 = new…
Q: Write a program that asks a user to enter a first name, a last name, and a year, and construct an…
A: As the language is not specified answer written in python
Q: Write a program in c ++ that inputs four numbers separated by spaces. The program should count how…
A:
Q: Write a program that generates a gradebook similar to the jenzabar grade book output: student name…
A: Note, as you haven't provided any programming language in the question so, I am using python…
Q: Question 2: Take a lowercase word as an input from the user. Modify the word in such a way that the…
A: Note: You have not specified any programming language, so I have written a python code to answer the…
Q: Write a method that computes the binary fraction representation of a positive integer. To find the…
A: Use a string to represent the numbers in binary format Then append the numbers at left of the string
Q: Write a program that translates a letter grade into a number grade. Letter grades are A, B, C, D,…
A: Code: #include <iostream>using namespace std; int main() { string grade; int…
Q: Exercise 3. Parameter Passing What are the values of y and z at the end of the following block under…
A: Here is the explanation regarding the code:
Q: In this question, you will implement the famous Guess the Number game in C as we've done in the…
A: Use an infinite loop till computer guesses the number Make the mid element of range as the computer…
Q: Write a program in c# that plays a guessing game with the user. Have your program read and store an…
A: C# program for the given problem:
Q: Write a program in C++ that will help an elementary school student learn multiplication. Use a…
A: Code:- #include <iostream>#include<cstdlib>using namespace std; int Input() {…
Q: What is the scope of identifier x which is declared in Line 4? Consider the following program: const…
A: Scope of the variable: Local variable: Variables declared inside the function or block are called…
Q: A company wants to secure users' passwords that consists of four digits only by encrytping them.…
A: The programming methodology for the program is given by: Including header files Function prototype…
Q: Dry run the below programs and explain the reasons of output. If there is any error then correct…
A: EXPLANATION class access{ public int x; static int y; // all static variables are common for all…
Q: Write a program that calculates the revenue of a trip of a train composed of several train-cars. For…
A: #include<iostream> #include<string> #include<vector> using namespace std; class…
Q: Write a C++ program that reads five cards from the user, then analyzes the cards and prints out the…
A: Program: #include <iostream>using namespace std;const int numCards = 5; // function…
Q: Write a java code for this problem General Statement: Read a string and determine whether each left…
A: Step 1:- Program Approach:- 1.import java.util.* 2.Create the class Main 3.Create the function…
Q: What is the probability that in a classroom of x people, at least 2 will be born on the same day of…
A: Given data, What is the probability that in a classroom of x people, at least 2 will be born on the…
Q: Write a program OrderCheck.java that takes four int command-line arguments w, x, y, and z. Define a…
A: Code Screenshot :
Q: Write a JavaScript function that accepts a number from a user as input and checks if the number is…
A: Step-1: Start Step-2: Declare a variable n and take input from user Step-3: Call function isPrime…
Q: 1. Write a program that separately prompts the user for a first name and last name and outputs a…
A: As per our guidelines we are supposed to answer?️ only one question. Kindly repost other questions…
Q: 2. Write a program that constructs a random telephone number of the form (XXX) XXX-XXXX and outputs…
A: Dear Student, The complete source code for the asked program is given in step 2 also comments have…
Q: Write a program that prompts the user for a sentence and display in new words. Your program should…
A: Below I have provided C++ Programming. Also, I have attached the screenshot of the code and output…
Q: Write a program that prompts the user for a sentence and display in new words. Your program should…
A: Here is the c++ code of the program. See below step for code.
Q: What is the scope of identifier x which is declared in Line 10? * Consider the following program:…
A: Given: To choose the correct option.
Q: Write a program in c++ for determining if a year is a leap year. In the Gregorian calendar system…
A: Coded using C++.
Q: You have a deck of cards of a strange game called Binary. Every card has a letter. The deck was…
A: Step 1:- Program Approach: These are instructions related to the code Include one header file…
Q: ite a program that reads two integers as input, and outputs the first integer and subsequent…
A: Required: Write a program that reads two integers as input, and outputs the first integer and…
Q: Write a program that requests a word (in lowercase letters) as input and translates the word into…
A: Step 1. Taking the inputs from the user. Step 2. Take text as in lower function. Step 3. Check word…
Q: Write a program that reads students’ names followed by their test scores. The program should output…
A: Required: Write a program that reads students’ names followed by their test scores. The program…
Q: ISP-Java Write a program whose input is two integers, and whose output is the first integer and…
A: Given: ISP-Java Write a program whose input is two integers, and whose output is the first integer…
Q: that reads a line of text, tokenizes the line using space characters as delimiters and outputs only…
A: Code: import java.util.*; class Main { public static void main(String[] args) { Scanner in=new…
Q: gram in C that displays the classic BINGO game, displays a BINGO card (5x5 square), and tests the…
A: Write a program in C that displays the classic BINGO game, displays a BINGO card (5x5 square), and…
Q: Write a function called monkey_experiment that takes in a goal string (e.g., "methinks it is like a…
A: Outputs:
Q: In JAVA A function foo takes three integers as input arguments, i.e., foo(int a, int b, int c). The…
A: A function foo takes three integers as input arguments, i.e., foo(int a, int b, int c). The three…
Q: Write a program that will read a line of text and output the number of words in the line and the…
A: #include<iostream>#include<cstring>#include<cctype>using namespace std; int…
Q: Given two strings ransomNote and magazine, return true if ransomNote can be constructed by using the…
A: def canConstruct(ransomNote: str, magazine: str) -> bool: if len(ransomNote) >…
Q: Write a C++ Program using using classes, that, given a number greater than zero (0), the user will…
A: The complete code is a given below .
Q: I need to make an ATM program that allows the user to check his or her balance after entering his or…
A: Python Code: import randomimport sys class ATM(): def __init__(self, name, account_number,…
Q: Write a C++ program that will prompt for and read in the names (first and last) and the final exam…
A: C++ program to prompt the user to enter the first and last names and the final exam scores of a…
Q: Take a string and a word(or string of some fınite length) from user and check whether this word is…
A: Required:- Take a string and a word(or string of some finite length) from the user and check whether…
Q: Write a program that reads students’ names followed by their test scores. The program should output…
A: The program will take input number to take that amount of student’s information. Then we have…
Q: 2. Write a program that constructs a random telephone number of the form (XXX) XXX-XXXX and outputs…
A: As no language is mentioned I am doing is using JAVA. As the number is generated randumly So, It…
Q: Write a program that prompts the user for a sentence and display in new words. Your program should…
A: Answer // C++ program that prompts the user for a sentence and display in new words. // Header file…
Q: 5.write a program that initializes a String variable with "Welcome to Jac444!". Then, u methods of…
A: Java code to perform given question is given below.
Java
Step by step
Solved in 4 steps with 3 images
- Write a program that prompts the user to enter adecimal number and displays the number in a fraction. (Hint: read the decimalnumber as a string, extract the integer part and fractional part from the string,and use the BigInteger implementation of the Rational class in Programming to obtain a rational number for the decimal number.) Here are somesample runs: Enter a decimal number: 3.25 ↵EnterThe fraction number is 13/4 Enter a decimal number: –0.45452 ↵EnterThe fraction number is –11363/25000Write a program in Java that creates a login name for a user, given the user's first name, last name, and a four-digit integer as input. Output the login name, which is made up of the first six letters of the first name, followed by the first letter of the last name, an underscore (_), and then the last digit of the number (use the % operator). If the first name has less than six letters, then use all letters of the first name. Ex: If the input is: Michael Jordan 1991 the output is: Your login name: MichaeJ_1 Ex: If the input is: Nicole Smith 2024 the output is: Your login name: NicoleS_4Write a program in C++ that will help an elementary school student learn multiplication. Use a Random object to produce two positive one-digit integers. The program should then prompt the student with a question, such as: How much is 6 times 7? The student then inputs the answer. Next, the program checks the student’s answer. If it’s correct, display a message from the possible responses to a correct answer below, and ask another multiplication question. If the answer is wrong, display a message from the possible responses to an incorrect answer below, display the same question again, and let the student try it repeatedly until the student finally gets it right. A separate function should be used to generate each new question. This function should be called once when the application begins execution and each time the student answers the question correctly. After the student gets five questions correctly, give him/her the opportunity to exit the program. The student might choose to…
- Write a program that reads students’ names followed by their test scores. The program should output each student’s name followed by the test scores and the relevant grade. It should also find and print the highest test score and the name of the students having the highest test score. Student data should be stored in a struct variable of type studentType, which has four components: studentFName and studentLName of type string, testScore of type int (testScore is between 0 and 100), and grade of type char. Suppose that the class has 20 students. Use an array of 20 components of type studentType. Your program must contain at least the following functions: A function to read the students’ data into the array. A function to assign the relevant grade to each student. A function to find the highest test score. A function to print the names of the students having the highest test score. Your program must output each student’s name in this form: last name followed by a comma, followed by a…Write a program that reads students’ names followed by their test scores. The program should output each student’s name followed by the test scores and the relevant grade. It should also find and print the highest test score and the name of the students having the highest test score. Student data should be stored in a struct variable of type studentType, which has four components: studentFName and studentLName of type string, testScore of type int (testScore is between 0 and 100), and grade of type char. Suppose that the class has 20 students. Use an array of 20 components of type studentType. Your program must contain at least the following functions: A function to read the students’ data into the array. A function to assign the relevant grade to each student. A function to find the highest test score. A function to print the names of the students having the highest test score. Your program must output each student’s name in this form: last name followed by a comma, followed by a…Write a Java program correctly that generates a report of proof of vaccination against COVID-19 for the peoplewho received their dose of vaccination. Write a program which:1. Display a welcome message.2. Then prompts the user to enter the following:• First name, with first letter uppercase, which is then stores in a variable of type String.• Last name, with first letter uppercase which is then stores in a variable of type String.• Day of birth, set as a number between 1 and 31, which is then stores in a variable of typeint.• Month of birth, set as a number between 1 and 12, which is then stores in a variable of typeint.• Year of birth, set as a number between 1920 and 2006, which is then stores in a variable oftype int.• Day of vaccination, set as a number between 1 and 31, which is then stores in a variable oftype int.• Month of vaccination. set as a number between 1 and 12, which is then stores in a variableof type int.• Year of vaccination, set as a number between 2020 and 2021,…
- When we say arithmetic expression, we mean a kind of expression you can type in a very basic desk calculator. That is, neither variables nor brackets are allowed. It contains only numbers and four arithmetic operators, +, -, *, and /. The following are some examples of arithmetic expression: Any number string with or without signs - e.g. 3, -1, +10, 3.14, -0.70 and 099. Number strings mixed with arithmetic operators - e.g. 3+5, -1+2*3, 7/10-0.7, and -1.4-+8.2. An example of FA diagram for recognising a non-negative integer is given below. You may use it as a start point. You need to add a few more states and transitions to handle numbers with decimal point and signs (e.g. -5, +2, 0.21, -32.6, +99.05, but not the form 1.0E-3). Most importantly, you also need to add a few more things to deal with the arithmetic operators +, -, *, /.Write a program that generates a gradebook similar to the jenzabar grade book output: student name grade letter grade Ahmed ... 90 A- honda 99 A+ Karim 60 D- you must use tuples, list and dictionaries appropriately to get the user input for the grades the grade should include all the categories in the coursework (classwork/homework, quizzes,midterm,final, lab and attendance) the assignments type weight listed in the syllabus must be used to compute the overall class gradeJava Write a program whose input is two integers, and whose output is the first integer and subsequent increments of 10 as long as the value is less than or equal to the second integer. For coding simplicity, output a space after every integer, including the last. Ex: If the input is: -15 30 the output is: -15 -5 5 15 25 Ex: If the second integer is less than the first as in: 20 5 the output is: Second integer can't be less than the first.
- Write the program that has two subroutines: one that builds a String object of a specified size and another that builds a StringBuilder object of the same size. Each of the subroutines is timed, using objects from the Timing class we developed at the beginning of the book. This procedure is repeated three times, first for building objects of 100 characters, then for 1,000 characters, and finally for 10,000 characters. The times are then listed in pairs for each size. code in c#Given the class Pet below, write a client program to read data for five pets and display the following data: name of smallest pet, name of largest pet, and average weight of the five pets. Make sure you explain and justify every line of your code using internal documentation to get full mark. /**Class for basic pet data: name, age, and weight. */ public class Pet {private String name;private int age; //in years private double weight;//in kg public Pet(String initialName, int initialAge, double initialWeight) {name = initialName;if ((initialAge < 0) || (initialWeight < 0)) { System.out.println("Error: Negative age or weight."); System.exit(0); } else {age = initialAge; weight = initialWeight; } } public void setPet(String newName, int newAge, double newWeight) { name = newName;if ((newAge < 0) || (newWeight < 0)) {System.out.println("Error: Negative age or weight."); System.exit(0); } else {age = newAge; weight = newWeight; } } public Pet(String initialName) {name =…In Java for zybooks ,Lab 3.27, Write a program that creates a login name for a user, given the user's first name, last name, and a four-digit integer as input. Output the login name, which is made up of the first six letters of the first name, followed by the first letter of the last name, an underscore (_), and then the last digit of the number (use the % operator). If the first name has less than six letters, then use all letters of the first name.