Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
11th Edition
ISBN: 9780134670942
Author: Y. Daniel Liang
Publisher: PEARSON
Question
Book Icon
Chapter 8, Problem 8.25PE
Program Plan Intro

Markov matrix

Program Plan:

  • Include the package “java.util.Scanner” into program.
  • Define the class named “Exercise08_25”.
    • Define the main method.
      • Define the scanner object “obj” to get input from user.
      • Declare and initialize a final variable “N” in type of integer.
      • Prompt the user and declare the two dimensional variable “arr” in type of “double”.
      • Using “for” loops, get input values for array “arr[][]”.
      • Call the method “isMarkovMatrix()” which pass the “arr” as argument in “if” condition.
        • Print appropriate statement on screen.
    • Define the “isMarkovMatrix()” Boolean method which pass two dimensional array “m[][]” as argument.
      • Using “for” loops and “if” condition, check the value of “m[][]” is less than “0”.
        • If the condition is true, return “false”.
      • Using “for” loop, add column values of matrix and return “true” if the value of “tot” equal to “1”. Otherwise return “false” to calling function.

Blurred answer
Students have asked these similar questions
Assignment (Math application): Write a program that prompts the user to enter a 3 x 3 matrix of double values and tests whether it is a positive Markov matrix. E An nxn matrix is a positive Markov matrix if the following is true: o lf each of the elements is positive o The sum of the elements in each column is 1 Sample Program running Enter a 3 x 3 matrix by row 0.15 0.875 0.375 0.55 0.005 0.225 0.30 0.12 0.4 The sum of the columns 1.0 1.0 1.0 It is a Markov matrix Enter a 3x 3 matrix by row -0.2 0.875 0.375 0.75 0.005 0.225 0.45 0.12 0.4 The sum of the columns 1.0 1.0 1.0 It is not a Markov matrix Please note the following requirements: Dinclude a comment before each method explaining what the methods will do E All methods called from the main methods There will be two methods which will be called from the main method: public static double [] [] createArray() 1. Creates a 3 by 3 two dimensional array of doubles 2. Prompts the user for values as shown in the sample run 3. Stores the…
An n x n matrix is called a positive Markov matrix if eachelement is positive and the sum of the elements in each column is 1. Write thefollowing method to check whether a matrix is a Markov matrix:public static boolean isMarkovMatrix(double[][] m) Write a test program that prompts the user to enter a 3 x 3 matrix of doublevalues and tests whether it is a Markov matrix. Here are sample runs:   Enter a 3−by−3 matrix row by row:0.15   0.875   0.375 ↵Enter0.55   0.005   0.225 ↵Enter0.30   0.12    0.4 ↵EnterIt is a Markov matrix   Enter a 3−by−3 matrix row by row:0.95   −0.875   0.375 ↵Enter0.65    0.005     0.225 ↵Enter0.30    0.22     −0.4 ↵EnterIt is not a Markov matrix
4x1+4x2+6x3+9x4=03x1+3x5=26x2+5x4+7x5=-46x1+8x4+2x5=54x5+7x2+6x3+8x1=-10Represent the set of equations in a matrix equation, Ax=b, where A is a square matrix and x and b are column vectors. Write the line of code to define matrix A for this problem matlab/octave language

Chapter 8 Solutions

Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)

Ch. 8.8 - Declare an array variable for a three-dimensional...Ch. 8.8 - Assume char[][][] x =new char[12][5][2], how many...Ch. 8.8 - Show the output of the following code: int[][][]...Ch. 8 - (Sum elements column by column) Write a method...Ch. 8 - (Sum the major diagonal in a matrix) Write a...Ch. 8 - (Sort students on grades) Rewrite Listing 8.2,...Ch. 8 - (Compute the weekly hours for each employee)...Ch. 8 - (Algebra: add two matrices) Write a method to add...Ch. 8 - (Algebra: multiply two matrices) Write a method to...Ch. 8 - (Points nearest to each other) Listing 8.3 gives a...Ch. 8 - (All closest pairs of points) Revise Listing 8.3,...Ch. 8 - Prob. 8.9PECh. 8 - (Largest row and column) Write a program that...Ch. 8 - (Game: nine heads and tails) Nine coins are placed...Ch. 8 - (Financial application: compute tax) Rewrite...Ch. 8 - (Locate the largest element) Write the following...Ch. 8 - (Explore matrix) Write a program that prompts the...Ch. 8 - (Geometry: same line ?) Programming Exercise 6.39...Ch. 8 - (Sort two-dimensional array) Write a method to...Ch. 8 - (Financial tsunami) Banks lend money to each...Ch. 8 - (Shuffle rows) Write a method that shuffles the...Ch. 8 - (Pattern recognition: four consecutive equal...Ch. 8 - Prob. 8.20PECh. 8 - (Central city) Given a set of cities, the central...Ch. 8 - (Even number of 1s) Write a program that generates...Ch. 8 - (Game: find the flipped cell) Suppose you are...Ch. 8 - (Check Sudoku solution) Listing 8.4 checks whether...Ch. 8 - Prob. 8.25PECh. 8 - (Row sorting) Implement the following method to...Ch. 8 - (Column sorting) Implement the following method to...Ch. 8 - (Strictly identical arrays) The two-dimensional...Ch. 8 - (Identical arrays) The two-dimensional arrays m1...Ch. 8 - (Algebra: solve linear equations) Write a method...Ch. 8 - (Geometry: intersecting point) Write a method that...Ch. 8 - (Geometry: area of a triangle) Write a method that...Ch. 8 - (Geometry: polygon subareas) A convex four-vertex...Ch. 8 - (Geometry: rightmost lowest point) In...Ch. 8 - (Largest block) Given a square matrix with the...Ch. 8 - (Latin square) A Latin square is an n-by-n array...Ch. 8 - (Guess the capitals) Write a program that...
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education