Write a program that reads a person's first and last names separated by a space, assuming the first and last names are both single words. Then the program outputs last name, first name. End with newline. Example output if the input is: Maya Jones Jones, Maya
Q: Write programs that read a sequence of integer inputs and print a. The smallest and largest of the…
A: #python program #reading data l=list(map(int,input().split())) #compute largest and smallest…
Q: Write a program that prints out the letters of a word, each followed by a dot (full stop or period)…
A: Wrtting the program below with comments :
Q: Write a program whose inputs are three integers, and whose output is the smallest of the three…
A: Java is one of the most extensively used language, and In most of the back end development projects,…
Q: Write a program to read a number representing the time in 24-hours (i.e., 4-digits). Then find the…
A: A specific programming language is specified. Therefore, writing the entire program in the java…
Q: Write a program that prompts the user to input an integer and then outputs both the individual…
A: Note :- As per our guidelines we are supposed to answer only one question. Kindly repost for the…
Q: Write a program that reads in hours, minutes, and seconds as input, and outputs the time in seconds…
A: h=int(input("Enter hours: "))m=int(input("Enter Minutes: "))s=int(input("Enter Seconds: "))sec=…
Q: Write a Python program which takes a number and prints the digits from the unit place, then the…
A: Write a python program that takes a number and prints the digits in reverse order.
Q: Write a program that reads a one-line sentence as input and then displays the following response: If…
A: As no programming language is mentioned, so I am using Python. In step 2, you will the Python…
Q: Write a program that reads in hours, minutes, as input, and outputs the time in minutes only.
A: The language i used is C++. I explained the program in comments of the code and also attached the…
Q: Write a Java program to take a string, print true if the string starts with "hi" and print false…
A: Introduction: Here we are required to create a JAVA program that checks whether a string starts with…
Q: Write a program to read a number representing the time in 24-hours (i.e., 4-digits ). Then find the…
A: Modulo(%) operator: The modulo operator (%) also called a remainder operator which is used to get…
Q: Write a program whose input is a string which contains a character and a phrase, and whose output…
A: input string store string first character in another variable. count number of that variable…
Q: Create a program that prints a square with its sides using the symbol "*" and its inside using the…
A: Using the given requirements, a C++ program can be made with the help of “for loops” with two…
Q: Write a program in python that takes a date as input and outputs the date's season. The input is a…
A: Step 1 Program Approach: Ask the user to enter month and day using split() to splits a string into…
Q: Suppose that the first number of a sequence is x, where x is an integer. Define a0= x; an+1=an/2 if…
A: Following is the C++ program that takes as input from user the value of x. Then using the while loop…
Q: Write a program whose input is a character and a string, and whose output indicates the number of…
A: Program: //import the required packages import java.util.Scanner; //define a class Main public class…
Q: Write a program that accepts a string input and outputs the number of characters in the string and…
A:
Q: Write a program that converts a given number of minutes into hours:minutes:seconds format. For…
A: C++ Program for above : #include <iostream> #include <iomanip> using namespace std;…
Q: Write a program that reads a person's first and last names, separated by a space. Then the program…
A:
Q: Write a program that read an integer, and then finds and prints the sum of the even and odd…
A: As per the requirement program is developed. Note : As per our guidelines we are suppose to answer…
Q: python Write a program that takes in a line of text as input, and outputs that line of text in…
A: Step 1:- Given:- Takes in a line of text as input, and outputs that line of text in reverse. The…
Q: Write a program that asks the user for a line of text and counts how many spaces, periods, or commas…
A: Since you have not mentioned any language, i will code it in python.
Q: Write a program that prompts the user to enter a telephone number expressed in letters and outputs…
A: #include<iostream> using namespace std; int main (){ string inputString, outputString;…
Q: Write a program that reads the value of x and y, then if x is bigger than or equal y calculate and…
A: Math functions used in the program Math.pow() Math.cos The program first inputs the value of x and…
Q: . Write a program if for example, the input: 6 8 2028 prints the date June 8, 2028.
A: Required: Use C# Write a program if for example, the input: 6 8 2028 prints the date June 8, 2028.
Q: Write a program that inputs two positive integers of, at most, 20 digits and outputs the sum of the…
A: Actually, program is a executable software that runs on a computer.
Q: Write a program that mimics a calculator. The program should take as input two integers and the…
A: A set of data from a sample of items is given. (a) The covariance between two random variables X and…
Q: Write a program to read and print 6 temperatures for 6 days and find the average for these degrees…
A: Since programming language was not mentioned , so I used PYTHON-- I have provided PYTHON CODE…
Q: Write a program that asks the user for the starting value of their number sequence, and the ending…
A: import java.util.*; public class Main { public static void main(String[] args) { Scanner sc=new…
Q: Write a program that prints the day number of the year, given the date in the form month-day-year.…
A: Programming Approach Declare a header file. Using namespace. Define function prototypes Declare a…
Q: Write a program, which takes an input from the user, if the number is between 90 100, Print A Grade,…
A: Since no programming language is mentioned, I am using python Algorithm: 1. Start 2. Take input…
Q: Write a program that asks the user for his name and salutes him using it. The prompt must be "What…
A: Given:
Q: Write a program that takes two string as a user input such as: 1. “hello world" 2. “hello people"…
A: Program code: #include <stdio.h> #include <string.h> int main() { //Declare the…
Q: Write a program that reads an integer and displays its first five multiples. For example, if the…
A: #asking for the inputa=int(input("Enter a number : "))#loop for the 5 multiplicantsfor b in…
Q: Write a program that asks the user how many credit units they have taken. If they have taken 23 or…
A: Program Approach: Include the necessary header files for the standard I/O. Declare a user input…
Q: Write a program that reads in three numbers from the keyboard and then prints those numbers in…
A: Two questions are asked. So the only the first question will be answered. Please upload another…
Q: Write a program that reads the full name of a student; and then prints it in the form: last first…
A: C++ Program: # include <iostream># include <string>using namespace std; int main(){…
Q: Write a program that works out whether if a given year is a leap year. A normal year has 365 days,…
A: As no programming language is mentioned, it is solved using basic C++
Q: Write a program that takes website names as keyboard input until the user types the word stop and…
A: Given :- Write a program that takes website names as keyboard input until the user types the word…
Q: Write down a program that will take an English letter as input and will print the next letter in the…
A: Input a character and then add 1 to it and display the updated character
Q: Write a program that will Input the name , position of the employee , Input the rate per hour, hours…
A: Program: #include <iostream> using namespace std; int main() { string name; int…
Q: Write a program that reads a person's first and last names separated by a space, assuming the first…
A: To Do: To write the C++ Code.
Q: Write a program that reads text from the user and reverses the order of every number that appears in…
A: Solution:-- 1)The given question has required for the solution to be provided with the help of the…
Q: Write a program that takes in any string (with or without spaces) and outputs the numbers each…
A: According to the Question below the Solution: Output:
Q: Write a program if for example, the input: 6 8 2028 prints the date June 8, 2028.
A: As no programming language is mentioned it is solved using basic C++
Q: Write a program that reads tenintegers, and then display the number of even numbers and odd numbers.…
A: Program: import java.util.Scanner;public class Test { public static void main(String[] args) {…
Q: Write a program whose input is a string which contains a character and a phrase, and whose output…
A: The user inputs a character and a phrase. The entered string is separated into individual elements.…
Q: Write a program that takes in a line of text as input, and outputs that line of text in reverse. The…
A: Programs: Programs are used to provide general instruction to the computer system. It is used to…
Q: Write a program whose inputs are three integers, and whose outputs are the largest of the three…
A: Python code for above: # function to return largest def largest_number(num1, num2, num3):…
Q: Write a program that reads a one-line sentence as input and then displays the following response: If…
A: charAt is the method in String class used to get the character at specified index length is the…
Q: Write a program that reads an integer and displays all its smallest factors in an increasing order.…
A: Since the program language not specified the program has been developed using Java to satisfy the…
Q: Write a program that inputs a number and checks whether it is a perfect number or not. A perfect…
A: PERFECT NUMBERS A perfect number is a number that is equal to the sum of its proper divisors.…
Q: Write a program that takes an age (for example 15) as input and prints something as "You look older…
A: Please find the answer below :
Write a program that reads a person's first and last names separated by a space, assuming the first and last names are both single words. Then the program outputs last name, first name. End with newline.
Example output if the input is: Maya Jones
Jones, Maya
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images
- import java.util.Scanner; public class LabProgram { public static Roster getInput(){ /* Reads course title, creates a roster object with the input title. Note that */ /* the course title might have spaces as in "COP 3804" (i.e. use nextLine) */ /* reads input student information one by one, creates a student object */ /* with each input student and adds the student object to the roster object */ /* the input is formatted as in the sample input and is terminated with a "q" */ /* returns the created roster */ /* Type your code here */ } public static void main(String[] args) { Roster course = getInput(); course.display(); course.dislayScores(); }} public class Student { String id; int score; public Student(String id, int score) { /* Student Employee */ /* Type your code here */ } public String getID() { /* returns student's id */…PLEASE REWIRETE THIS CODE USING "The J Option Pane Class" import java.util.Scanner;public class Main{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("Enter money to withdraw: "); int amount = sc.nextInt(); if(amount <= 20) System.out.println("INSUFFICIANT AMOUNT"); else System.out.println("Collect your money! RM"+amount); }}Java Language Please help me fix all the error. I very appreciate it Coding: import java.util.Scanner;public class Main { /*static displayline(); char line; { for (int i = 1; i < line; i++ ) { System.out.println ("_"); } } */ public static void main(String[] args) { System.out.println("Clinic Management\n"); int PatAge, Pnumber,age; int cmedicine, cost, Pcost, total, newTotal; String PatName, Pgender, Pdisease, Pmedicine; char typeofmedicine; Scanner scan = new Scanner(System.in); System.out.println("Patient Name :"); String name = scan.next(); name = name + scan.nextLine(); System.out.println("Patient Age :"); age = scan.nextInt(); System.out.println("Patient Gender :"); String gender = scan.next(); System.out.println("Patient Phone Number :"); Pnumber = scan.nextInt(); System.out.println("Patient Disease :" ); String disease =…
- How do I mahe my code output results Java? Code: import java.util.Scanner; class FinalExamAnswer{ public static void main(String [] args) { manipulateString(); //calls function } //your code here public static void manipulateString() { Scanner sc=new Scanner(System.in); //create Scanner instance System.out.print("Enter a sentence: "); String sentence=sc.nextLine(); //input a sentence String[] words=sentence.split(" "); //split the sentence at space and store it in array for(int i=0;i<words.length;i++) //i from 0 to last index { if(i%2==0) //if even index words[i]=words[i].toUpperCase(); //converted to upper case else //if odd index words[i]=words[i].toLowerCase(); //converted to lower case } for(int i=words.length-1;i>=0;i--) //i from last index to 0 { System.out.print(words[i]+"…please see image for instructions starter code for Main.java import java.io.*;import java.util.*;; public class Main { public static void main(String[] args) { // TODO Auto-generated method stub System.out.println(countConnectedComponents("data.txt")); } public static int countConnectedComponents(String fileName) { try { //the file to be opened for reading FileInputStream fis=new FileInputStream(fileName); Scanner sc=new Scanner(fis); //file to be scanned //returns true if there is another line to read ArrayList<int []> edge = new ArrayList<int[]>(); Set<String> set = new HashSet<String>(); while(sc.hasNextLine()) { int temp [] = new int[2]; int index = 0; for(String s : sc.nextLine().split(" ")) { temp[index] =…How do I fix the error Java? ReceiptMaker.java:6: error: invalid method declaration; return type required ItemClass(String name, double price) { ^ Code: import java.util.Scanner; public class FinalExamAnswers{ public static void main(String [] args) { manipulateString(); //calls function } //your code here public static void manipulateString() { Scanner sc=new Scanner(System.in); //create Scanner instance System.out.print("Enter a sentence: "); String sentence=sc.nextLine(); //input a sentence String[] words=sentence.split(" "); //split the sentence at space and store it in array for(int i=0;i<words.length;i++) //i from 0 to last index { if(i%2==0) //if even index words[i]=words[i].toUpperCase(); //converted to upper case else //if odd index words[i]=words[i].toLowerCase(); //converted to lower case }…
- package Rayjack_Lab03;import java.util.Scanner;public class RayJack_Lab03 {public static void main(String []args) {Scanner sc= new Scanner(System.in); //System.in is a standard input stream.int firstNum,secondNum;System.out.print("enter first value: ");firstNum=sc.nextInt();System.out.print("enter second value: ");secondNum=sc.nextInt();if (firstNum>=secondNum)System.out.println("It is True to say that first value "+firstNum+" is larger or equal to Second value"+secondNum);elseSystem.out.println("It is False to say that first value "+firstNum+" is larger or equal to Second value "+secondNum);}}Q. Please guide on how to take decimal values in this proggram's output as well.Please determine errors and correct it. package test; import java.util.Scanner; public class Test { public static void main(String[] args) {String fname,lname; int hrsworked; Double payrate,income,fnfp,paye,fiji,medical=6.50,total_deduction,netpay; Scanner sc = new Scanner(System.in); System.out.print("\nEnter Employee First Name: "); fname = sc.nextLine(); System.out.print("Enter Employee Last Name: "); lname = sc.nextLine(); System.out.println("Enter Employee Hours Worked: "); hrsworked = sc.nextInt(); System.out.print("Enter Employee Pay Rate: "); payrate = sc.nextDouble(); income = hrsworked * payrate; fnfp = income*0.085; paye = income*0.065; fiji = income*0.0285; total_deduction = hrsworked + fnfp + paye + fiji +medical; netpay = income-total_deduction; System.out.printf("\n*-------------* Pay Slip for: %s *-------------*\n",(fname+" "+lname)); System.out.printf("Fortnightly Income: $ %.2f\n",income); System.out.printf("Hours Worked: \n", hrsworked); System.out.printf("FNPF: $…import java.util.Scanner; public class Inventory { public static void main (String[] args) { Scanner scnr = new Scanner(System.in); InventoryNode headNode; InventoryNode currNode; InventoryNode lastNode; String item; int numberOfItems; int i; // Front of nodes list headNode = new InventoryNode(); lastNode = headNode; int input = scnr.nextInt(); for(i = 0; i < input; i++ ) { item = scnr.next(); numberOfItems = scnr.nextInt(); currNode = new InventoryNode(item, numberOfItems); currNode.insertAtFront(headNode, currNode); lastNode = currNode; } // Print linked list currNode = headNode.getNext(); while (currNode != null) { currNode.printNodeData(); currNode…
- 8.Coding below srason 1 two ir more Questionimport java.util.* ; public class MaxFinder{ public static void main(String[] args) { //average high temperatures for Toronto according to gocanada. String temperatures = "-2 -1 4 11 18 24 27 26 21 14 7 0" ; Scanner scanner = new Scanner(temperatures) ; int hottestTemp = 0 ; int hottestMonth = 0 ; int coldestTemp = 0 ; int coldestMonth = 0 ; //-----------Start below here. To do: approximate lines of code = 14 // 0. initialize month //1. write a while loop that reads temperatures from scanner (assume you do not know how many values there will be, so use the hasNextInt() method) ; // Hint: use scanner.hasNextInt() in the loop condition // Don't forget to increment variable month //2. if this is the first month or an extreme month, update the hottestMonth,hottestTemp or coldestMonth,coldestTemp variables ; // an extreme month means the temperature for this month is > the…Make this code runableimport java.io.Serializable; public class Customer implements Serializable { int id; private String name; private String mobileno; private String address; private String pincode; private Item i; public Customer(String name, String mobileno, String address,String pincode, Item i) { this.name = name; this.mobileno = mobileno; this.address = address; this.pincode=pincode; this.i=i; } public int getId() { return id; } public void setId(int id) { this.id = id; } public Item getI() { return i; } public void setI(Item i) { this.i = i; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getMobileno() { return mobileno; } public void setMobileno(String mobileno) { this.mobileno = mobileno; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public String getPincode() { return pincode; } public void setPincode(String pincode) { this.pincode…See ERROR in Java file 2: Java file 1: import java.util.Random;import java.util.Scanner; public class Account {// Declare the variablesprivate String customerName;private String accountNumber;private double balance;private int type;private static int numObjects;// constructorpublic Account(String customerName, double balance, int type) { this.customerName = customerName;this.balance = balance;this.type = type;setaccountNumber(); // set account number functionnumObjects += 1;}private void setaccountNumber() // definition of set account number{Random rand = new Random();accountNumber = customerName.substring(0, 3).toUpperCase();accountNumber += type;accountNumber += "#";accountNumber += (rand.nextInt(100) + 100);}// function to makedepositvoid makeDeposit(double amount){if (amount > 0){balance += amount;}}// function for withdrawboolean makeWithdrawal(double amount) {if (amount < balance)balance -= amount;elsereturn false;return true;}public String toString(){return accountNumber +…