Microsoft Visual C#
7th Edition
ISBN: 9781337102100
Author: Joyce, Farrell.
Publisher: Cengage Learning,
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 7, Problem 1E
Create a C# statement that uses each of the following built-in methods you have used in previous chapters, then make an intelligent guess about the return type and parameter list for the method used in each statement you created.
a. Console.WriteLine()
b. String. Equals()
c. String. Compare()
d. Convert.Tolnt32 ()
e. Convert. Tochar()
f. Array. Sort()
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Java Programming: Below is the shank.java file which is the main method file along with shank.txt. The main goal is to make sure to use this method: (List<String> lines = Files.readAllLines(Paths.get(filename));) to read the text file. Show the full code with the text file being read in the output. There must be no error at all.
package mypack;
import java.io.IOException;import java.nio.charset.Charset;import java.nio.charset.StandardCharsets;import java.nio.file.Files;import java.nio.file.Path;import java.nio.file.Paths;import java.util.List;
public class Shank { public static void main(String[] args) { Path filePath = Paths.get("shank.txt"); Charset charset = StandardCharsets.UTF_8; if (args.length != 1) { System.out.println("Error: Exactly one argument is required."); System.exit(0); }
String filename = args[0];
try { List<String> lines = Files.readAllLines(Paths.get(filename));
for (String line : lines) { try {…
using System;
class Program{ // Define PrintBoard method public static void PrintBoard() { Console.WriteLine(" X | | "); Console.WriteLine(" | | "); Console.WriteLine(" | O | "); Console.WriteLine(); } public static void Main(string[] args) { PrintBoard(); // Call PrintBoard method PrintBoard(); // Call it again PrintBoard(); // And again! }}
This program is really simple and basic to print a tic tac toe board for the user to eventually play the computer in C#. How can it be modified a little bit to print the board and have each tile labeled with a number to identify the space? I'm a beginner and would like to take this step by step in modifying the code. Thank you!
In Python:
What gets printed by executing the following code?
def teststrings():str1 = 'X University'str2 = 'Computer Science'print(str1[0].isupper()) #str3 = str1.replace("university',' ')str2+=' ' +str1print(str1)print(str3.rstrip())print(str2)def main():teststrings()main()
Chapter 7 Solutions
Microsoft Visual C#
Ch. 7 - At most, a class can contain ____________...Ch. 7 - Prob. 2RQCh. 7 - Prob. 3RQCh. 7 - Prob. 12RQCh. 7 - Create a C# statement that uses each of the...Ch. 7 - Create a program named SalesLetter whose Mai n...Ch. 7 - Prob. 3ECh. 7 - Create an application named...Ch. 7 - Prob. 7ECh. 7 - Prob. 8E
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Is there a reason why the system takes off the first letter of the name when it shows the user with the highest GPA? How can I fix it. The bug is in bold. Thank you! #include "stdafx.h"#include <iostream>#include <string> using namespace std; //declare Student Class class Student { //private member of class private: string Full_Name; float Student_GPA; int Student_Rank; //public class members public: //function to get student name void setStudentdata(string SN, float GPA, int rank) { Full_Name = SN;Student_GPA = GPA;Student_Rank = rank; } //return student name function void getStudentdata(string &SN, float &GPA, int &rank) { SN = Full_Name;GPA = Student_GPA;rank = Student_Rank;} }; int main() { Student info[3];//variable declaration string studentName; float studentGpa; int studentRank; //prompt user to enter name GPA and rank for (int i = 0; i < 3; i++) { cout << "\nEnter record for Student " << i + 1; cout << "\nName:…arrow_forwardREUPLOAD: I need to fill the program to its designated output I have inserted sample runs and the template of codes that will be used(?) Thank you! I TYPED DOWN THE CODE W/ THE PICTURE ATTACHED: import java. util. Formatter;import java. util. Scanner;public class Chupapi {private static Formatter output;public static void main (String[] args) throws Exception {output = new Formatter("output.txt");Scanner in = new Scanner(System.in);} // This method has one parameter and will return the string with all uppercase characters.public static String toUpperCase(String str) {// This method has one parameter and will return the number of vowels in the string.public static int countVowels(String str) {int numvowels = 0;return numvowels;}// This method has one parameter and Witt return true if the string is o pot indrome,// fotse if the string is not o potindrome.public static boolean isPalindrome(String str){boolean isReversible;return isReversible;}//This method hos three porometers and will…arrow_forwardIn python please - all sections (there are 3 in total) except the last 3 pages included in the images, last section included in text below, thank you. Do not change the function names or given starter code in your script. Each class has different requirements, read them carefully and ask so I can comment to clarify. Do not use the exec or eval functions, nor are you allowed to use regular expressions. This includes multiple methods interacting with each other over the course of execution. All methods that output a string must return the string, not print it. If you are unable to complete a method, use the pass statement to avoid syntax errors. Last 3 pages continued - calculate(self) A property method that evaluates the infix expression saved in self.__expr. First convert the expression to postfix, then use a stack to evaluate the output postfix expression. You must use the Stack defined in section 1 in this method, otherwise your code will not receive credit. Input (excluding…arrow_forward
- Your job is to write an extension method called toRoman to convert and int to its roman representation so that a client code such as below would work. static void Main(string[] args) { int i = 99; string s = i.toRoman(); Console.WriteLine(s); } Hint: Review Module 2-Chapter 3 slides and Extension Methods - C# Programming Guide from Microsoft to understand how to implement an extension method is. There are example code there too Hint: You can refer to this link for the algorithm to convert a decimal to a roman number. Hint: If you have issues compiling your code, make sure to include the extended method in its own static class with its own namespace.arrow_forwardDefine stubs for the methods called by the below main(). Each stub should print "FIXME: Finish methodName()" followed by a newline, and should return -1. Example output: FIXME: Finish getUserNum() FIXME: Finish getUserNum() FIXME: Finish computeAvg() Avg: -1 import java.util.Scanner; public class MthdStubsStatistics { /* Your solution goes here */ public static void main(String [] args) {int userNum1;int userNum2;int avgResult; userNum1 = getUserNum();userNum2 = getUserNum(); avgResult = computeAvg(userNum1, userNum2); System.out.println("Avg: " + avgResult);}}arrow_forwardIn Java. Sort the list of cars and display them. Sort by make, model, and year. Each car property is separated by a tab character: \t Output width: 15 (make), 25 (model), 5 (year) I already have a code but it doesn't sort right. import java.util.*;import java.io.*;class Test{public static void main(String args[]){try{File file=new File("cars.txt");Scanner sc=new Scanner(file);sc.nextLine();while(sc.hasNext()){String line=sc.nextLine();String data[]=line.split("\t");String make=data[0];String model=data[1];String year=data[2];System.out.printf("%15s%25s%5s\n",make,model,year);}}catch(Exception e){System.out.println(e);}}} ////////////////// cars.txtmake model yearFord Expedition 2003Mazda B-Series 1989Ford Freestar 2003Hyundai Elantra 2001Hyundai Entourage 2008Chevrolet Camaro 2011Chevrolet Monte Carlo 2006Chevrolet Blazer 1996Chevrolet Aveo 2005Chevrolet Corvette 1999Mercedes-Benz E-Class 2006Dodge Avenger 1995Pontiac Grand Prix 1973Mitsubishi Outlander 2011MINI Clubman 2011Suzuki…arrow_forward
- Implement the below pseudo-code in a Java program using a while loop and aswitch-case statement. The program should be well structured, and the taskperformed under each option (at least options 'b' to 'e') should be implementedas a separate method.NOTE: The Scanner class does not have a method to input a character. Inorder to read a character from the keyboard, use one of the following methods(after declaring the Scanner object):static Scanner kb = new Scanner(System.in);1. char ch = kb.nextLine().charAt(0); OR2. char ch = kb.nextLine().toLowerCase().charAt(0);where kb is a Scanner class object.The second method above also converts the input to lowercase, which is oftenuseful. Though these methods allow the user to input more than one characteron the input line, the rest of the line (after capturing the first character withcharAt(0)) is discarded.If you also want to ignore the leading spaces before the first character thenuse:1. char ch = kb.nextLine().trim().charAt(0); OR2. char ch =…arrow_forwardJAVA PROGRAM Please Modify this program with further modifications as listed below: The program must pass the test case when uploaded to Hypergrade. ALSO, change the following in the program: System.out.print("Enter a name (or 'QUIT' to exit): "); to: Enter a name to search or type QUIT to exit and take out this: System.out.println(filename + " is missing. Exiting..."); import java.io.*;import java.util.*;public class Main { public static void main(String[] args) { List<String> girlsNames = loadNames("GirlNames.txt"); List<String> boysNames = loadNames("BoyNames.txt"); Scanner scanner = new Scanner(System.in); while (true) { System.out.print("Enter a name (or 'QUIT' to exit): "); String input = scanner.nextLine(); if (input.equalsIgnoreCase("QUIT")) { break; } searchAndDisplay(input, girlsNames, boysNames); } scanner.close(); } private static…arrow_forwardinstructions are in photo and links in photos has code which I have pasted to make it easy to copy. Below is my professor code for Sudoku #2, please make a different version of this code with the same functions as i can not use my teacher's code Sudoku #2 code import java.util.*;import java.io.*; public class MySudokuBoard {public final int SIZE = 9;protected char[][] myBoard;public MySudokuBoard(String theFile) {myBoard = new char[SIZE][SIZE];try {Scanner file = new Scanner(new File(theFile));for(int row = 0; row < SIZE; row++) {String theLine = file.nextLine();for(int col = 0; col < theLine.length(); col++) {myBoard[row][col] = theLine.charAt(col);}}} catch(Exception e) {System.out.println("Something went wrong :(");e.printStackTrace();}}public boolean isSolved() {if(!isValid())return false;Map<Character,Integer> map = new HashMap<>();for(char[] row : myBoard) {for(char cell : row) {if(map.containsKey(cell))map.put(cell, map.get(cell) + 1);elsemap.put(cell, 1);}}//…arrow_forward
- JAVA Program ASAP Please modify this program and take out the main method from the program so it passes the test cases in Hypergrade. I have provided the failed test cases. import java.io.BufferedReader;import java.io.FileReader;import java.io.IOException;import java.util.ArrayList;import java.util.Arrays;import java.util.InputMismatchException;import java.util.Scanner;public class FileSorting { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); while (true) { System.out.println("Please enter the file name or type QUIT to exit:"); String fileName = scanner.nextLine(); if (fileName.equalsIgnoreCase("QUIT")) { break; } try { ArrayList<String> lines = readFile(fileName); if (lines.isEmpty()) { System.out.println("File " + fileName + " is empty."); } else { performSorting(lines);…arrow_forwardCould you help me with this one too, please Regex, APIs, BeautifulSoup: python import requests, refrom pprint import pprintfrom bs4 import BeautifulSoup complete the missing bodies of the functions below: def group_chat(text_message, friend):"""Question 2- Your friends are blowing up your group chat. Given a string of text messagesfrom your friends and a specific friend's name, return the first text messagethey sent, excluding their name.- Each text message ends with either a ?, !, or .- Your code must be written in one line. Args:text_message (astr)friend (astr)Returns:str of first match>>> text_message = "Madison: How are you guys going today?" + \"Anna: I'm doing pretty well!" + \"Madison: That's good to hear. How is everyone else?">>> friend = "Madison">>>group_chat(text_message, friend)How are you guys going today?"""pass test code: # text_message = "Madison: How are you guys going today?" + \# "Anna: I'm doing pretty well!" + \#…arrow_forwardcan you please write in java.util.scanner form ,can you please make it so i can copy and past it int[] numbers = {345, 632, 675, 157, 834, 294, 832};1. Write a method to find its highest value. 2. Write a method to find its lowest value. 3. Write a method to find its total value.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Memory Management Tutorial in Java | Java Stack vs Heap | Java Training | Edureka; Author: edureka!;https://www.youtube.com/watch?v=fM8yj93X80s;License: Standard YouTube License, CC-BY